Windows 7 Copy one hidden file to multiple folders

HFX

Joined
Oct 1, 2011
Messages
2
Reaction score
0
I want to copy one hidden file to appr 600 subfolders in one parent folder. Using Ctrl-C and then Ctrl-V will not be my cop of tea.

I actually found one cmd command (thanks to SlimJim) that worked for one ordinary file, but not hidden:

[FONT=&quot]File path:[/FONT] [FONT=&quot]C:\Users\Andreas\Desktop\Test\Test.txt[/FONT]
[FONT=&quot]Parent folder:[/FONT] [FONT=&quot]C:\Users\Andreas\Desktop\Test\Album[/FONT]
[FONT=&quot]Cmd command:[/FONT] [FONT=&quot]for /D %a in (C:\Users\Andreas\Desktop\Test\Album\*) do copy C:\Users\Andreas\Desktop\Test\Test.txt “%a”[/FONT]

Does anyone know how to accomplish this with a hidden file?

(Writing a batch file with the name of each folder is not fun)

/Andreas
 

HFX

Joined
Oct 1, 2011
Messages
2
Reaction score
0
I found the solution.

If you want to do this the command is:

[FONT=&quot]for /D %a in ([destination folder]\*) do xcopy [source file] “%a” /H /K /Y

"[,]" [/FONT]is not part of expression, however "(,)" is!

[FONT=&quot]/H[/FONT][FONT=&quot]: Copies hidden files as well[/FONT]
[FONT=&quot]/K[/FONT][FONT=&quot]: Keeps attributes[/FONT]
[FONT=&quot]/Y[/FONT][FONT=&quot]: Suppresses prompting to confirm you want to overwrite an existing destination file[/FONT]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top