Got a credit card? use our Credit Card & Finance Calculators
Thanks to Anonymous,bruncher,niord,gvonge,Shelford, for Donating to support the site
Search and copy certain files please?
-
- Lemon Slice
- Posts: 989
- Joined: November 4th, 2016, 10:31 am
- Has thanked: 340 times
- Been thanked: 460 times
Search and copy certain files please?
Can't believe I'm asking this because I'm sure it's elementary, but I'm in the middle of a big brain fog.
I have an SD card, full of folders. These contain epubs, and various other types of e-books.
I want to search the card, and copy all the *.epub files to a folder on my pc.
What's a DOS command to do this, or is there a simple Windows program that I can use to get the same result?
Quick pointers/suggestions very appreciated - I'm off now to contemplate why my brain is failing...
I have an SD card, full of folders. These contain epubs, and various other types of e-books.
I want to search the card, and copy all the *.epub files to a folder on my pc.
What's a DOS command to do this, or is there a simple Windows program that I can use to get the same result?
Quick pointers/suggestions very appreciated - I'm off now to contemplate why my brain is failing...
-
- Lemon Quarter
- Posts: 2503
- Joined: November 7th, 2016, 2:40 pm
- Has thanked: 84 times
- Been thanked: 832 times
Re: Search and copy certain files please?
Something like:
xcopy z:\*. epub c:\yourfolder /s (where the SD card is here mounted as a Z: drive) ?
xcopy z:\*. epub c:\yourfolder /s (where the SD card is here mounted as a Z: drive) ?
-
- Lemon Half
- Posts: 6142
- Joined: November 5th, 2016, 9:05 am
- Has thanked: 21 times
- Been thanked: 1428 times
Re: Search and copy certain files please?
NomoneyNohoney wrote:What's a DOS command to do this
In DOS you use the dir command. dir /? will give the various search and display options.
You then direct the output to a file using the > symbol and edit the file into a DOS batch file to do the copying.
That's the 1980s method, other more sophisticated methods are no doubt available. (xcopy as the earlier poster suggests)
-
- Lemon Half
- Posts: 9109
- Joined: November 4th, 2016, 1:16 pm
- Has thanked: 4140 times
- Been thanked: 10061 times
Re: Search and copy certain files please?
stewamax wrote:
Something like:
xcopy z:\*. epub c:\yourfolder /s (where the SD card is here mounted as a Z: drive) ?
I think that will also copy and maintain any sub-folder structure from the source, which may or may not be what NmNh is looking for?
In case it isn't, and he wishes to 'flatten' any folder sub-structure from the source, then he'll have to make a .BAT file using the following code, which will copy epub files from sub-folders in the source folder, but dump all the individual files found under the single destination folder, with no 'parent' sub-folder structure copied over -
pushd C:\source
for /r %%a in (*.epub*) do (
COPY "%%a" "C:\destination\%%~nxa"
)
popd
Tested on Windows 10 DOS with a couple of text files, and seems to work well enough....
C:\source and C:\destination will need changing in the above code to suit, of course.....
Cheers,
Itsallaguess
-
- Lemon Half
- Posts: 6142
- Joined: November 5th, 2016, 9:05 am
- Has thanked: 21 times
- Been thanked: 1428 times
Re: Search and copy certain files please?
Itsallaguess wrote:
pushd C:\source
for /r %%a in (*.epub*) do (
COPY "%%a" "C:\destination\%%~nxa"
)
popd
pushd and popd are developments to DOS when it retreated to just being a command line subset of Windows.
-
- Lemon Slice
- Posts: 989
- Joined: November 4th, 2016, 10:31 am
- Has thanked: 340 times
- Been thanked: 460 times
Re: Search and copy certain files please?
Ah - you guys have been busy while I was experimenting! First method copied directories with the epubs in to another folder, but all I want is the epubs, no folders. I reckon itsallaguess's is the method I'll need. I'll report back when I'm sorted.
Just for conversation, I was trying to use a program called Everything, from here: https://www.voidtools.com. Extremely useful, if you guys want to have a quick look at it - see if it's useful to you. No, I'm not on commision!
Just for conversation, I was trying to use a program called Everything, from here: https://www.voidtools.com. Extremely useful, if you guys want to have a quick look at it - see if it's useful to you. No, I'm not on commision!
-
- Lemon Slice
- Posts: 989
- Joined: November 4th, 2016, 10:31 am
- Has thanked: 340 times
- Been thanked: 460 times
Re: Search and copy certain files please?
Hmm.. SD card is H:\
Open cmd prompt, cd into H:\
Type pushd H:\
Press enter to insert the next line (for /r %%a in (*.epub*) do ( ) etc...
Pressing enter executes the "pushd H:\" bit, and I can't go any further..
(Enter sad face emoticon here.)
AAArgh!
Open cmd prompt, cd into H:\
Type pushd H:\
Press enter to insert the next line (for /r %%a in (*.epub*) do ( ) etc...
Pressing enter executes the "pushd H:\" bit, and I can't go any further..
(Enter sad face emoticon here.)
AAArgh!
-
- Lemon Half
- Posts: 9109
- Joined: November 4th, 2016, 1:16 pm
- Has thanked: 4140 times
- Been thanked: 10061 times
Re: Search and copy certain files please?
NomoneyNohoney wrote:
Open cmd prompt, cd into H:\
Type pushd H:\
Press enter to insert the next line (for /r %%a in (*.epub*) do ( ) etc...
Pressing enter executes the "pushd H:\" bit, and I can't go any further..
(Enter sad face emoticon here.)
AAArgh!
You've got to save the whole routine in a text file and rename it as a .BAT batch file, and then run that from a DOS window....
'then he'll have to make a .BAT file using the following code'...
Cheers,
Itsallaguess
-
- Lemon Slice
- Posts: 989
- Joined: November 4th, 2016, 10:31 am
- Has thanked: 340 times
- Been thanked: 460 times
Re: Search and copy certain files please?
Oh ignore me! "Make a BAT file..." Doh! It's notepad that's needed, not a CMD prompt! I'm gonna leave this for a while, I'm making too many stupid mistakes at the moment. I'll come back to it later.
-
- Lemon Slice
- Posts: 989
- Joined: November 4th, 2016, 10:31 am
- Has thanked: 340 times
- Been thanked: 460 times
Re: Search and copy certain files please?
Itsallaguess: We crossed messages - you telling me what I'd just realised!
Anyway, my message about "Everything" particularly had you in mind, after you enjoyed another program called Cathy, a long time ago... I suspect you'd enjoy investigating that program.
Have fun as JonEBehr would say
Anyway, my message about "Everything" particularly had you in mind, after you enjoyed another program called Cathy, a long time ago... I suspect you'd enjoy investigating that program.
Have fun as JonEBehr would say
-
- Lemon Quarter
- Posts: 4137
- Joined: November 4th, 2016, 9:24 am
- Has thanked: 3292 times
- Been thanked: 2871 times
Re: Search and copy certain files please?
If you don't want to muck about with DOS, you can just do it with Windows Explorer.
Open Explorer for your SD card
Type *.epub into the search box (this will also search all the sub-folders)
When it has listed all the files, ctrl-A to select the files, ctrl-C to copy them
Locate the folder you want to copy them to then ctrl-V
But, for sure, DOS is much more fun
--kiloran
Open Explorer for your SD card
Type *.epub into the search box (this will also search all the sub-folders)
When it has listed all the files, ctrl-A to select the files, ctrl-C to copy them
Locate the folder you want to copy them to then ctrl-V
But, for sure, DOS is much more fun
--kiloran
-
- Lemon Slice
- Posts: 989
- Joined: November 4th, 2016, 10:31 am
- Has thanked: 340 times
- Been thanked: 460 times
Re: Search and copy certain files please?
~Update! Couldn't leave it alone - the batch file has worked perfectly, so I'm going to keep that in my box of "useful things to know and have."
Now it's time for the next part of the process.
Thanks all - deep joy...
Now it's time for the next part of the process.
Thanks all - deep joy...
-
- Lemon Quarter
- Posts: 3971
- Joined: November 4th, 2016, 1:04 pm
- Has thanked: 733 times
- Been thanked: 1587 times
Re: Search and copy certain files please?
DOS commands? Yuck.
Install some proper grown up Unix tools for this sort of thing. Cygwin is very good: https://www.cygwin.com/
Alternatively on Windows 10, you could try the Windows Subsystem for Linux: https://docs.microsoft.com/en-us/windows/wsl/about
Install, open a shell, create the destination directory destDir, then simply
find sourceDir -type f -iname '*epub' -exec cp {} destDir \;
sourceDir is the path to the SD card, in Unixy land /cygdrive/h with Cygwin, /mnt/h with WSL if the SD card is H:
Install some proper grown up Unix tools for this sort of thing. Cygwin is very good: https://www.cygwin.com/
Alternatively on Windows 10, you could try the Windows Subsystem for Linux: https://docs.microsoft.com/en-us/windows/wsl/about
Install, open a shell, create the destination directory destDir, then simply
find sourceDir -type f -iname '*epub' -exec cp {} destDir \;
sourceDir is the path to the SD card, in Unixy land /cygdrive/h with Cygwin, /mnt/h with WSL if the SD card is H:
-
- Lemon Quarter
- Posts: 3271
- Joined: March 7th, 2018, 8:14 pm
- Has thanked: 2244 times
- Been thanked: 594 times
Re: Search and copy certain files please?
Just install a sensible OS, and hack something out on the command line with UNIX power tools...
-
- Lemon Slice
- Posts: 453
- Joined: April 13th, 2017, 11:37 am
- Has thanked: 241 times
- Been thanked: 154 times
Re: Search and copy certain files please?
NomoneyNohoney wrote:Quick pointers/suggestions very appreciated - I'm off now to contemplate why my brain is failing...
Navigate in windows explorer to the root of the sd card.
search for "epub"
Copy and paste the search results to the desired directory on your PC.
-
- Lemon Half
- Posts: 8597
- Joined: November 8th, 2016, 5:56 am
- Has thanked: 4559 times
- Been thanked: 3681 times
Re: Search and copy certain files please?
NomoneyNohoney wrote:I was trying to use a program called Everything, from here: https://www.voidtools.com. Extremely useful, if you guys want to have a quick look at it - see if it's useful to you. No, I'm not on commision!
Everything is almost essential for my sanity
- I'd go mad if I had to remember where I put anything
And while functionality like it has crept in to most OS, it shows you even the copies of the files that the OS doesn't think you're interested in
- I find it hard to live without if I ever need to use something without it (same goes for BeyondCompare)
-sd
Return to “Technology - Computers, TV, Phones etc.”
Who is online
Users browsing this forum: Steveam and 9 guests