Simple replace/rename directories and files?

LanceBraun

New Member
Joined
Aug 21, 2013
Messages
4
Good evening.

With an excel macro, how could I rename, a folder/subfolders along with files in each by
i) replacing the EstimateNumber with a JobNumber (the JobNumber exists in NextJobNum.txt)
ii) adding the job number to the front of all files within the directory and cub-directories.

I imagine this would be accomplished by by SELECTING the estimate number on a spread sheet and clicking a "Convert to Job button" (which would also change the selected cell to the value in the NextJobNum.txt file.

More Detail:
Our Estimate folders are created like this (always with a decreasing negative number, assuming an Estimate Number of -3432)

Est No. - Client - Product - Who Pays the bills

-3432 - JIM DAVIS - PEPSI COLA - UPSTREAM PRODUCTIONS

with subfloders:
-010 --3432 - CLIENT INFO - PEPSI COLA - JIM DAVIS
Schedule.txt
Job Description.txt
-020 --3432 - RENDERINGS -PEPSI COLA - JIM DAVIS
Client renderings.pdf
millions of pics.jpg
-030 --3432 - SHOP DRAW - PEPSI COLA - JIM DAVIS
and so on...

Each folder holds various files of job information

We would like them to read when finished (assuming the next job number is 8000):
8000 - JIM DAVIS - PEPSI COLA - UPSTREAM PRODUCTIONS
with subfloders:
-010 - 8000 - CLIENT INFO - PEPSI COLA
8000 - Schedule.txt
8000 - Job Description.txt
-020 - 8000 - RENDERINGS -PEPSI COLA
8000 - Client renderings.pdf
8000 - million of pics.jpg
-030 - 8000 - SHOP DRAW - PEPSI COLA

It is possible someone may have a file open when this macro is run - perhaps a warning with a delayed renaming try at 1AM? Or a warning on who has what file open and we can tell them to shut it?

Thanks gents. I again for the length of this.

LB
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
I'd like to use an excel macro.
There's a lot of specifics above. Let me rephrase:
I'd like to replace the first four digits of a directory name with a name in memory. I would like to look at all sub directories and do the same.

Sound doable?
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top