View previous topic :: View next topic |
Author |
Message |
t-buch
Joined: 27 Aug 2007 Posts: 9 Location: Denmark
|
Posted: Mon Aug 27, 2007 10:32 am Post subject: Automate the naming process of new Folders |
|
|
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 |
|
 |
admin Site Admin
Joined: 09 Mar 2007 Posts: 448 Location: Canada
|
Posted: Tue Aug 28, 2007 4:18 am Post subject: |
|
|
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 |
|
 |
t-buch
Joined: 27 Aug 2007 Posts: 9 Location: Denmark
|
Posted: Thu May 08, 2008 7:41 am Post subject: |
|
|
Thanks a lot - it works fine
But what if I want to count from 01 or 17 etc? |
|
Back to top |
|
 |
admin Site Admin
Joined: 09 Mar 2007 Posts: 448 Location: Canada
|
Posted: Fri May 09, 2008 4:26 am Post subject: |
|
|
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 |
|
 |
t-buch
Joined: 27 Aug 2007 Posts: 9 Location: Denmark
|
Posted: Fri May 09, 2008 4:33 am Post subject: |
|
|
Again thanks a lot |
|
Back to top |
|
 |
|