Is there a way in command prompt to take one file and copy it into another folder and its subdirectories based on its name?
I have an image named 5.jpg that has been put in a sub-folder that is in every folder in a directory. I want to do a search inside of the folder (with the old image) and its sub-folders and replace all of the results with the new image.
Simply hold down the Shift key and click with the right mouse button in the Explorer on the folder where you want to create additional subfolders.
Here is how you can do that: Type Notepad in Windows search and click Open. In the Notepad window, click type @ECHO OFF and click Enter. After you have typed down the names of all the folders and subfolders that you want to create, navigate to File in the top-left corner and choose Save as.
To copy a directory with all subdirectories and files, use the cp command.
Go to the folder where you had bulk files, press CTRL+A to select all files. Now go and expand the Home ribbon on top and click either Move to or Copy to as per your requirement. Then select Choose location, if you want to move the files to user created folder.
Probably there is one more (simpler) way.
Use the replace
command:
replace C:\SourceFile.Txt C:\Some_Root_Folder_Which_Contains_Multiple_SubFolders /s
As the command itself says it just replaces the file, which already existed in sub-directories.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With