Hi all, this is my first post on this forum.
I need to populate about 200 folders with the same file. I googled but couldn't find anything on this, so I'm hoping there's a way to do it using batch commands. Otherwise I'll need to browse to each folder individually and paste the file into them, which will take a lot of time.
Thanks
PS:
The file I want to add is ".directory". It tells XP what image to use (i.e. "folder.jpg")when a folder is viewed as a thumbnail. I'm using it for my music collection.
If you want to try this, just create a txt file with this text:
[Desktop Entry]
Icon=./folder.jpg (you can also use png images)
Rename it ".directory" and put it in the same folder as an album's mp3's and album cover. Go to that folder's parent and switch to thumbnail view, and the album cover should display. Pretty cool.
Populate multiple folders with a particular file?
Moderator: DosItHelp
-
- Posts: 4
- Joined: 02 Nov 2009 17:50
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
Code: Select all
set "file=c:\path to\your file\.directory"
set "parentdir=c:\path to\the parent folder"
cd /d "%parentdir%"
for /d /r %%a in (*) do copy "%file%" "%%a"
-
- Posts: 4
- Joined: 02 Nov 2009 17:50
-
- Posts: 4
- Joined: 02 Nov 2009 17:50
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
Well, by default it will not overwrite -- so in essence it'll only copy if it doesn't exist. You can use
copy "%file%" "%%a" >nul 2>nul
to supress any errors. If you really want to exclude directories that already have the file, then:
copy "%file%" "%%a" >nul 2>nul
to supress any errors. If you really want to exclude directories that already have the file, then:
Code: Select all
set "fdir=c:\path to\your file
set "fname=.directory"
set "parentdir=c:\path to\the parent folder"
cd /d "%parentdir%"
for /d /r %%a in (*) do if not exist "%%~a\%fname%" do copy "%fdir%\%fname%" "%%~a"