A Windows XP help forum. PCbanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » PCbanter forum » Microsoft Windows 7 » Windows 7 Forum
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

.BAT File To Copy Files from Many Subdirs Into Single Dir?



 
 
Thread Tools Rate Thread Display Modes
  #1  
Old November 9th 17, 05:05 PM posted to alt.windows7.general
(PeteCresswell)
external usenet poster
 
Posts: 1,933
Default .BAT File To Copy Files from Many Subdirs Into Single Dir?

Thousands of photos - all in subdirectories like "2010 04-06 Easter At
Angela's"

I want to copy all photos into a single directory/share so they are
visible in a totally-flat file structure.

Reason: I have a Tivo-on-Steroids home media app that has a "SlideShow"
feature and it's randomizing algorithm seems flawed somehow and I am
hoping that copying everything into a flat file will remedy that.
--
Pete Cresswell
Ads
  #2  
Old November 9th 17, 05:26 PM posted to alt.windows7.general
NY
external usenet poster
 
Posts: 586
Default .BAT File To Copy Files from Many Subdirs Into Single Dir?

"(PeteCresswell)" wrote in message
...
Thousands of photos - all in subdirectories like "2010 04-06 Easter At
Angela's"

I want to copy all photos into a single directory/share so they are
visible in a totally-flat file structure.

Reason: I have a Tivo-on-Steroids home media app that has a "SlideShow"
feature and it's randomizing algorithm seems flawed somehow and I am
hoping that copying everything into a flat file will remedy that.


So are do the files in all the various folders have names that are
completely unique, or will there be any duplication between a file in folder
A and the same filename in folder B?

Assuming that there are no duplicates, are all files named in folder order
(eg files 1-10 in folder A, 11-20 in folder B etc).

In other words, if you create this flat structure, will all the files that
were in one folder still be grouped together (by virtue of having
consecutive filenames) afterwards?

Or does none of this matter if you want the T-o-S to randomise the order or
displaying photos?

  #3  
Old November 9th 17, 06:40 PM posted to alt.windows7.general
Puddintane
external usenet poster
 
Posts: 17
Default .BAT File To Copy Files from Many Subdirs Into Single Dir?

Easy
Get "Everything". free to use.

Set it up (Tools\Options\NTFS etc) to look at all drives and wait for
it to complete.
You will have a list of all files on those selected drives.

Filter for *.jpg *.bmp or whatever.

Select all files you want to copy.

Right-click to copy, the mouse to the destination and click Paste.

Everything will then update and show the new folder with all files.
So next time just sort on path and select by that sorted portion.

The new Everything sorts quickly.

  #4  
Old November 9th 17, 06:45 PM posted to alt.windows7.general
(PeteCresswell)
external usenet poster
 
Posts: 1,933
Default .BAT File To Copy Files from Many Subdirs Into Single Dir?

Per NY:
So are do the files in all the various folders have names that are
completely unique, or will there be any duplication between a file in folder
A and the same filename in folder B?


Totally unique.

Assuming that there are no duplicates, are all files named in folder order
(eg files 1-10 in folder A, 11-20 in folder B etc).


No.

In other words, if you create this flat structure, will all the files that
were in one folder still be grouped together (by virtue of having
consecutive filenames) afterwards?


No, but it does not matter bco the randomized presentation. The
original copies will still exist in their folders - this will strictly
be a sort of "Temp" area for the benefit of the T-o-S app.

My plan would be to, every so often, wipe the area clean and simply
re-copy into it.


I'm thinking something around iterating directories and recursing
through them, but my knowledge of .BAT syntax is rudimentary at best.
--
Pete Cresswell
  #5  
Old November 9th 17, 07:04 PM posted to alt.windows7.general
Big Al[_5_]
external usenet poster
 
Posts: 1,588
Default .BAT File To Copy Files from Many Subdirs Into Single Dir?

On 11/09/2017 12:05 PM, (PeteCresswell) wrote:
Thousands of photos - all in subdirectories like "2010 04-06 Easter At
Angela's"

I want to copy all photos into a single directory/share so they are
visible in a totally-flat file structure.

Reason: I have a Tivo-on-Steroids home media app that has a "SlideShow"
feature and it's randomizing algorithm seems flawed somehow and I am
hoping that copying everything into a flat file will remedy that.

Make a text file with like notepad and call it something you understand
like: duplicate.bat
Then edit it (don't launch it).
Add lines like:
copy sourcedir\*.* destinationdir
this will copy all files from source to destination. Sample like
copy c:\folder1\folder2\*.* D:\mediafolder
then do another line like
copy C:\folder1\folder3\*.* D:\mediafolder
this will again copy the 2nd folder (3) to your mediafolder
keep doing lines like this till every folder and every file is copied.

as a matter of fact you could even clear the folder first by adding this
line at the beginning:
del D:\mediafolder\*.*
which will purge the media folder before the next lines will copy files.

Once you've done all the edits just save it and then if you double click
it, it will run and do what you type.
Just be aware that you type it right. Especially the del command. It
will delete files even if you put the wrong folder. Many a system has
been corrupted by doing bad commands.

Make a system image if you would feel more safe.
.... don't hold me responsible for errors. It's your validation to check...

  #6  
Old November 9th 17, 07:20 PM posted to alt.windows7.general
T
external usenet poster
 
Posts: 4,600
Default .BAT File To Copy Files from Many Subdirs Into Single Dir?

On 11/09/2017 09:05 AM, (PeteCresswell) wrote:
Thousands of photos - all in subdirectories like "2010 04-06 Easter At
Angela's"

I want to copy all photos into a single directory/share so they are
visible in a totally-flat file structure.

Reason: I have a Tivo-on-Steroids home media app that has a "SlideShow"
feature and it's randomizing algorithm seems flawed somehow and I am
hoping that copying everything into a flat file will remedy that.

Hi Pete,

You would iterate with the "find" command.

-T
  #7  
Old November 9th 17, 07:21 PM posted to alt.windows7.general
T
external usenet poster
 
Posts: 4,600
Default .BAT File To Copy Files from Many Subdirs Into Single Dir?

On 11/09/2017 11:20 AM, T wrote:
On 11/09/2017 09:05 AM, (PeteCresswell) wrote:
Thousands of photos - all in subdirectories like "2010 04-06 Easter At
Angela's"

I want to copy all photos into a single directory/share so they are
visible in a totally-flat file structure.

Reason: I have a Tivo-on-Steroids home media app that has a "SlideShow"
feature and it's randomizing algorithm seems flawed somehow and I am
hoping that copying everything into a flat file will remedy that.

Hi Pete,

You would iterate with the "find" command.

-T


And it is a complete and total pain in the ass to figure out.
If you are still interested, I can see if I have any examples kicking
around.
  #8  
Old November 9th 17, 07:23 PM posted to alt.windows7.general
Mayayana
external usenet poster
 
Posts: 6,438
Default .BAT File To Copy Files from Many Subdirs Into Single Dir?

"(PeteCresswell)" wrote

| I want to copy all photos into a single directory/share so they are
| visible in a totally-flat file structure.
|
Here's a VBScript version. Save as .vbs file, edit
the two paths to suit. This assumes no going into
subfolders. That can also be done but would require
a slightly different script. As written this goes through
all subfolders in sFol1 and copies all files in the top
level of those folders to sFol2.
It would be easy to also do things like file extension
filter or counter if you need those.

'-----------begin script-------------

Dim oFol, oFols, oFils, oFol1, sFol1, sFol2, FSO, oFil

Set FSO = CreateObject("Scripting.FileSystemObject")
sFol1 = "D:\photos" 'source parent folder.
sFol2 = "D:\Backup" 'destination folder.

On Error Resume Next
Set oFol1 = FSO.GetFolder(sFol1)
Set oFols = oFol1.SubFolders
For Each oFol in oFols
Set oFils = oFol.Files
For Each oFil in oFils
FSO.CopyFile oFil.path, sFol2 & "\" & oFil.name, True
Next
Set oFils = Nothing
Next
Set oFols = Nothing
Set oFol1 = Nothing
Set FSO = Nothing
Msgbox "Done."


  #9  
Old November 9th 17, 07:23 PM posted to alt.windows7.general
Sjouke Burry[_2_]
external usenet poster
 
Posts: 275
Default .BAT File To Copy Files from Many Subdirs Into Single Dir?

On 9-11-2017 18:05, (PeteCresswell) wrote:
Thousands of photos - all in subdirectories like "2010 04-06 Easter At
Angela's"

I want to copy all photos into a single directory/share so they are
visible in a totally-flat file structure.

Reason: I have a Tivo-on-Steroids home media app that has a "SlideShow"
feature and it's randomizing algorithm seems flawed somehow and I am
hoping that copying everything into a flat file will remedy that.

The way I have done that:

In a cmd window go to the directory containing your tree.
Then type : dir /b/s *.* a.bat

Get the a.bat in a text editer(I use notepad++)

remove all lines you dont want(dirs et.),

Then do a wildcard change of for example "C:" into "copy c:"

Then run the batch file inside the directory where you want them.
  #10  
Old November 9th 17, 07:28 PM posted to alt.windows7.general
Sjouke Burry[_2_]
external usenet poster
 
Posts: 275
Default .BAT File To Copy Files from Many Subdirs Into Single Dir?

On 9-11-2017 18:05, (PeteCresswell) wrote:
Thousands of photos - all in subdirectories like "2010 04-06 Easter At
Angela's"

I want to copy all photos into a single directory/share so they are
visible in a totally-flat file structure.

Reason: I have a Tivo-on-Steroids home media app that has a "SlideShow"
feature and it's randomizing algorithm seems flawed somehow and I am
hoping that copying everything into a flat file will remedy that.

If you use the sjideshow option of IFRANVIEW , that produces a

nice slideshow,fullscrren if you want to.

You can save the filelist for later use.
  #11  
Old November 9th 17, 07:38 PM posted to alt.windows7.general
Paul[_32_]
external usenet poster
 
Posts: 11,873
Default .BAT File To Copy Files from Many Subdirs Into Single Dir?

Puddintane wrote:
Easy
Get "Everything". free to use.

Set it up (Tools\Options\NTFS etc) to look at all drives and wait for
it to complete.
You will have a list of all files on those selected drives.

Filter for *.jpg *.bmp or whatever.

Select all files you want to copy.

Right-click to copy, the mouse to the destination and click Paste.

Everything will then update and show the new folder with all files.
So next time just sort on path and select by that sorted portion.

The new Everything sorts quickly.


In other words, it doesn't have to be a .bat file.

You can use the output pane of a Search window, wipe
over the selections you want, copy and paste.

For example, if I search using the search in the
upper right corner, for

ext:jpg

then the search pane will contain every JPG on that
volume. (Assumes I was viewing the top level of C:
at the time.)

If I make a compound search

ext:jpg AND filename:angela

maybe I can select a subset of them. Then, it's just
a matter of settling on a search package you like.
Windows Search, Agent Ransack, VoidTools Everything.exe
and learning their search language.

Windows Search can miss stuff, depending on whether a volume
is fully indexed or not. The other two are less likely to
miss stuff. Only disk areas marked "Access Denied" are
going to be a real limitation, and your photos aren't
likely to be in C:\System Volume Information :-)

With the Windows Search, you can search on the
metadata, like maybe

ext:jpg AND camera:Nikon AND width:1920

HTH,
Paul
  #12  
Old November 9th 17, 08:07 PM posted to alt.windows7.general
Java Jive
external usenet poster
 
Posts: 391
Default .BAT File To Copy Files from Many Subdirs Into Single Dir?

On 09/11/2017 17:05, (PeteCresswell) wrote:
Reason: I have a Tivo-on-Steroids home media app that has a "SlideShow"
feature and it's randomizing algorithm seems flawed somehow and I am
hoping that copying everything into a flat file will remedy that.


Would an HTML page be of use?
www.macfh.co.uk/Temp/SlideShow.html?I=5000
.... which uses a script file ...
www.macfh.co.uk/Temp/General.js

The HTML page is self-documented. Here is the General.js documentation:
http://www.macfh.co.uk/JavaJive/Prog...b/General.html

You could generate the file names to insert by something like ...
cd parentfolder
dir /b /s *.jpg dir.txt
.... and then copying the names out of dir.txt into the source of the
html page to replace the demonstration pics within it. However, note
that each name must be enclosed in quotes, and all lines containing
filenames except the last must end in a comma, as demoed in the existing
HTML source.

The default time interval is 3 mins, but this can be changed by editing
the source, or appending a parameter ?I=interval in milliseconds, as in
the above URL.

  #14  
Old November 10th 17, 04:17 PM posted to alt.windows7.general
(PeteCresswell)
external usenet poster
 
Posts: 1,933
Default .BAT File To Copy Files from Many Subdirs Into Single Dir?

Per Puddintane:
Get "Everything". free to use.

Set it up (Tools\Options\NTFS etc) to look at all drives and wait for
it to complete.


That did the trick - albeit only one directory deep.... but that was
plenty good enough.

Stumbled for awhile on the NTFS setup, but once it dawned on me it went
OK.

Thanks!
--
Pete Cresswell
  #15  
Old November 11th 17, 01:24 AM posted to alt.windows7.general
J. P. Gilliver (John)[_4_]
external usenet poster
 
Posts: 2,679
Default .BAT File To Copy Files from Many Subdirs Into Single Dir?

In message ,
"(PeteCresswell)" writes:
Per Puddintane:
Get "Everything". free to use.

Set it up (Tools\Options\NTFS etc) to look at all drives and wait for
it to complete.


That did the trick - albeit only one directory deep.... but that was
plenty good enough.

Stumbled for awhile on the NTFS setup, but once it dawned on me it went
OK.

Thanks!


I'm puzzled by the "only one directory deep" comment.

(I recently was looking for a scan I'd done around a certain date, but
couldn't remember the name I'd given it; I just told Everything to find

.jpg

, and sorted by date, and found it - at least four directories down from
the D: root.
--
J. P. Gilliver. UMRA: 1960/1985 MB++G()AL-IS-Ch++(p)Ar@T+H+Sh0!:`)DNAf

That's how he [Dr. Who] seems to me. He's always been someone who gets the
/Guardian/. There are some parts of the universe where it's harder to get hold
of. - Peter Capaldi (then-current incumbent Doctor), RT 2016/11/26-12/2
 




Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off






All times are GMT +1. The time now is 12:43 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 PCbanter.
The comments are property of their posters.