I’m attached to a network drive with a ridiculously slow connection speed (15 kb/s on good days). I’m deleting most files but don’t want to break a few files that have include statements. These are files for an enterprise app (mainly written in ColdFusion). My idea is to prefix a ‘_’ to all file names as to test if the few files I want to keep get messed up. I already searched the code of files I want to keep for include statements, this is just to test before pushing live.
Is there a script I can run that would rename all files and folders but exclude 2 folders and the files in them? If there’s a better way I’m open to options.
So I’d normally delete all files I think aren’t needed, but since the network speed is terrible that would take a long time. Since this is testing if I make a mistake there could be a lot of deleting and undeleting, that’s why I want to just rename.
I suggest appending an extension of
._instead of prefixing the name with_. That will make it easier to undo the rename.To revert back to the original names:
EDIT:
The first script to rename the files can be made faster by renaming all files in a directory with a single REN command.
The second script to revert the names must continue to rename each file individually.
I also added SETLOCAL to all scripts.