| 1. |
Solve : check for data in a folder using a batch file? |
|
Answer» How can I check for data in a folder using a batch if statement. So basically if folder A has data or directories in it, then do these set of commands, one gotcha here is that I don't know what the name of the data or folders will be???Not being specific about your OS, nor being specific about subfolders of folders, I can only give you a pseudo code outline of how you might go about this: For example, say I have a folder called "Websites". Within this folder are two subfolders "Images" and "html". I want to make a batch file that will reside in the "websites" folder that will rename all extensions in the "html" subdirectory to .htm, and all the images in the "images" directory to .tiff. This part is easy: Code: [Select]ren .\images\*.* *.tiff ren .\html\*.* *.htm This is the part where I got completely CONFUSED: Quote This would be applied on a large scale so switching from one directory to the other by typing in CD directory to the batch file would be impossible. Instead I want the batch file to locate, enter and perform operations within all subdirectories by itself. At some point in time, you will need a pointer to the files to be renamed. With WinXP you should use a script. Batch is vastly underpowered for this type of operation. Judging from your post you would need to walk the directory tree and identify HTML and Images directories before doing any rename operation. Good luck. 8-) |
|