• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

How to insert a single file into all subfolders

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

c627627

c(n*199780) Senior Member
Joined
Feb 18, 2002
I need to insert a single file into all subfolders. In other words every subdirectory of a folder needs to contain a specific file.

EDIT: This is a problem because the file that needs to be inserted is an empty file called .nomedia and Windows does not allow file names which have no characters followed by an extension... Does that mean this can only be done in Linux/Android?

EDIT: Never mind .nomedia is recursive on Android devices, you just have to REBOOT! It will take care of the folder and all the subfolders too.


As an FYI, this is why I was asking: http://www.overclockers.com/forums/showthread.php/771751
 
Last edited:
you can copy a file in all folders of a directory by using following command

for /F %g in ('dir /AD/B/S') DO copy c:\myfile %g

explanation:

In above command:- %g is a variable, dir /AD/B/S :- is a command to view all folders and sub folders of a directory, /F :- is a switch which we used with for command,if we want to iterate through the results of a command enclosed in bracket (in our case it is ('dir /AD/B/S'), c:\myfile:- is the file which we want to copy in all sub folders

Source: http://stackoverflow.com/questions/1321355/copy-to-all-folders-batch-file/1321539#1321539

I just tried this and it works! Just make sure to do it at the root of your SD card to start with, so you don't do every folder on your HDD :) Windows search & then delete would be able to reverse that though.

It'll only do it one tree down though. So if you're on Y: then every directory in Y: would get it, but not their sub directories. I'm sure there's another flag you can use to make it do all sub directories.
 
Back