Peters Flexible RenAmiNg Kit (PFrank) Forum Index Peters Flexible RenAmiNg Kit (PFrank)
Support and Discussion Site for the PFrank File/Folder Renaming Tool (http://www3.telus.net/pfrank)
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Automate the naming process of new Folders

 
Post new topic   Reply to topic    Peters Flexible RenAmiNg Kit (PFrank) Forum Index -> General Support
View previous topic :: View next topic  
Author Message
t-buch



Joined: 27 Aug 2007
Posts: 9
Location: Denmark

PostPosted: Mon Aug 27, 2007 10:32 am    Post subject: Automate the naming process of new Folders Reply with quote

sorry but I am not sure if this question should have been posted in either "Regular Expressions" or "User Defined Commands".
I Hope it's okay to post it here

I just want to make a lot new folders which should be named "Year week" like "07 week 35" "07 Week 36" and so on

Can the program help me automate the naming process of creating new folders?

Thanking very much in anticipation

Thomas (DK)
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 446
Location: Canada

PostPosted: Tue Aug 28, 2007 4:18 am    Post subject: Reply with quote

Creating folders does not fall under the renaming category for which PFrank was developed but enough people have asked me about doing this that I've provided the functionality with a sample user-defined command - i.e. commands that users create and essentially plug in to the application.

Here's how to create the folders:
1)
ensure you have version 2.03 as this has the sample folder creation command.
2)
If you are set up to edit python files on your PC (i.e. you have associated an editor with .py files) then you can skip this step. Otherwise
from your desktop create a text file called xx.py and then open it by double-clicking it. If it opens, then great, just close it again, delete it and proceed to step 3.
If you get the 'Windows cannot open the file' dialog box, then choose the 'select the program from a list' option. The 'Open with' dialog box should appear. From here check the box labelled: 'Always use the selected program to open this type of file''. Now select your favourite text editor.
Once the file is open, just close it again and delete it. At this point you have associated an editor with python (.py) files.
3)
Start PFrank and set up your current folder on the main window. Browse for the folder or just drag it in.
4)
In the main window press the 'Edit' button of the main panel. The PFrankUser.py file should open.
This file contains user defined commands. 3 sample commands are available as templates. One of them is used to create folders. The default names are just numbers. e.g. 001, 002, 003, etc.

From your request I'll assume that the year is supposed to always be 07.
Just edit the following 2 lines:
a)
Change 'self.maxnewfolders = 10' to 'self.maxnewfolders = 52'
b)
Change 'name = "%03d"%counter' to 'name = "07 week %02d"%counter'

Save the file and exit.
You've just created a plug-in command file for PFrank.

5)
Now it's time to plug it in!
Press the 'Verify' button of the main panel. You should see messages come up in the summary panel at the bottom of the window. This tells you the results of the command checking that occurs and whether the file compiles and whether the user commands are valid.
If successful, you'll se a prompt to re-initialize. Just press 'Yes'.

6)
PFrank will restart. You should see the new command under the 'pre-defined command pull down menu. The command called "(User) - Create 52 Folders Before Scan" will be near the bottom. Select that command and press 'Insert in List'.

The command will appear in the custom renaming list.

7)
Press Scan and the new folders will be created in the 'current folder'.
They will be named '07 week 01, 07 week 02, 07 week 03, ...'

8)
You're done!
The user-defined command will always be available whenever PFrank runs. If you want to change the names of the folders, just edit the line as was done in step 4b.

Let me know how it goes and if you have any questions.

Peter.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
t-buch



Joined: 27 Aug 2007
Posts: 9
Location: Denmark

PostPosted: Thu May 08, 2008 7:41 am    Post subject: Reply with quote

Thanks a lot - it works fine

But what if I want to count from 01 or 17 etc?
Back to top
View user's profile Send private message
admin
Site Admin


Joined: 09 Mar 2007
Posts: 446
Location: Canada

PostPosted: Fri May 09, 2008 4:26 am    Post subject: Reply with quote

If you mean: 'how do you start the folder counter at 1 instead of 0', then change the following line in the plugin file:

for counter in range(self.maxnewfolders) :

to:

for counter in range(1, self.maxnewfolders) :


Peter.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
t-buch



Joined: 27 Aug 2007
Posts: 9
Location: Denmark

PostPosted: Fri May 09, 2008 4:33 am    Post subject: Reply with quote

Again thanks a lot
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Peters Flexible RenAmiNg Kit (PFrank) Forum Index -> General Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group. Hosted by phpBB.BizHat.com


Start Your Own Video Sharing Site

Free Web Hosting | Free Forum Hosting | FlashWebHost.com | Image Hosting | Photo Gallery | FreeMarriage.com

Powered by PhpBBweb.com, setup your forum now!
For Support, visit Forums.BizHat.com