Kinook Software Forum

Kinook Software Forum (https://www.kinook.com/Forum/index.php)
-   [VBP] General Discussion (https://www.kinook.com/Forum/forumdisplay.php?f=2)
-   -   Rename file to its folder's name. (https://www.kinook.com/Forum/showthread.php?t=4994)

raghuk 04-11-2012 10:00 AM

Rename file to its folder's name.
 
I have about 20 directories which get updated every day at a certain location in the system.

Eg.,

ABC folder contains ABC_2012_04_11_045308_1288340.txt

XYZ folder contains XYZ_2012_04_11_045308_1288340.txt

I need to loop through each folder,

- find the file that matches the folder name
- Rename the file to its folder name

Eg., ABC_2012_04_11_045308_1288340.txt Should become ABC.txt

Here's what I'm doing.


%PROCFILES_ROOT_DIR%%PROCFILES_FILE_DIR%
*.bak
[FormatDirectoryName("%PROCFILES_FILE_DIR%")]
0
-1
-1
-1
[FormatDirectoryName("%PROCFILES_FILE_DIR%")]
-1
2
Rename Files


I see that the above step finds the files, but does not rename them. What am I missing?

Renaming files/folders in 'D:\Backups\ABC\'...
ABC_2012_04_11_045308_1288340.txt not renamed
1 file(s)/folder(s) processed, 0 file(s)/folder(s) renamed
4/11/2012 10:46:30 AM: Building project step 16 - Process Files ALL...

kinook 04-11-2012 10:41 AM

1 Attachment(s)
See the attached sample.

raghuk 04-11-2012 11:17 AM

That worked.. I had to check "Process once for each folder containing matching files".

Thank you!


All times are GMT -5. The time now is 07:03 PM.


Copyright © 1999-2023 Kinook Software, Inc.