Donate to Remove ads

Got a credit card? use our Credit Card & Finance Calculators

Thanks to Rhyd6,eyeball08,Wondergirly,bofh,johnstevens77, for Donating to support the site

Search and copy certain files please?

Seek assistance with all types of tech. - computer, phone, TV, heating controls etc.
NomoneyNohoney
Lemon Slice
Posts: 979
Joined: November 4th, 2016, 10:31 am
Has thanked: 337 times
Been thanked: 449 times

Search and copy certain files please?

#245449

Postby NomoneyNohoney » August 19th, 2019, 1:54 pm

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...

stewamax
Lemon Quarter
Posts: 2460
Joined: November 7th, 2016, 2:40 pm
Has thanked: 84 times
Been thanked: 804 times

Re: Search and copy certain files please?

#245455

Postby stewamax » August 19th, 2019, 2:15 pm

Something like:
xcopy z:\*. epub c:\yourfolder /s (where the SD card is here mounted as a Z: drive) ?

Alaric
Lemon Half
Posts: 6065
Joined: November 5th, 2016, 9:05 am
Has thanked: 20 times
Been thanked: 1416 times

Re: Search and copy certain files please?

#245456

Postby Alaric » August 19th, 2019, 2:21 pm

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)

Itsallaguess
Lemon Half
Posts: 9129
Joined: November 4th, 2016, 1:16 pm
Has thanked: 4140 times
Been thanked: 10032 times

Re: Search and copy certain files please?

#245461

Postby Itsallaguess » August 19th, 2019, 2:28 pm

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

Alaric
Lemon Half
Posts: 6065
Joined: November 5th, 2016, 9:05 am
Has thanked: 20 times
Been thanked: 1416 times

Re: Search and copy certain files please?

#245470

Postby Alaric » August 19th, 2019, 3:05 pm

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.

NomoneyNohoney
Lemon Slice
Posts: 979
Joined: November 4th, 2016, 10:31 am
Has thanked: 337 times
Been thanked: 449 times

Re: Search and copy certain files please?

#245471

Postby NomoneyNohoney » August 19th, 2019, 3:19 pm

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!

NomoneyNohoney
Lemon Slice
Posts: 979
Joined: November 4th, 2016, 10:31 am
Has thanked: 337 times
Been thanked: 449 times

Re: Search and copy certain files please?

#245475

Postby NomoneyNohoney » August 19th, 2019, 3:25 pm

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!

Itsallaguess
Lemon Half
Posts: 9129
Joined: November 4th, 2016, 1:16 pm
Has thanked: 4140 times
Been thanked: 10032 times

Re: Search and copy certain files please?

#245476

Postby Itsallaguess » August 19th, 2019, 3:29 pm

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

NomoneyNohoney
Lemon Slice
Posts: 979
Joined: November 4th, 2016, 10:31 am
Has thanked: 337 times
Been thanked: 449 times

Re: Search and copy certain files please?

#245477

Postby NomoneyNohoney » August 19th, 2019, 3:31 pm

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.

NomoneyNohoney
Lemon Slice
Posts: 979
Joined: November 4th, 2016, 10:31 am
Has thanked: 337 times
Been thanked: 449 times

Re: Search and copy certain files please?

#245480

Postby NomoneyNohoney » August 19th, 2019, 3:34 pm

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

kiloran
Lemon Quarter
Posts: 4112
Joined: November 4th, 2016, 9:24 am
Has thanked: 3252 times
Been thanked: 2855 times

Re: Search and copy certain files please?

#245481

Postby kiloran » August 19th, 2019, 3:35 pm

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

NomoneyNohoney
Lemon Slice
Posts: 979
Joined: November 4th, 2016, 10:31 am
Has thanked: 337 times
Been thanked: 449 times

Re: Search and copy certain files please?

#245485

Postby NomoneyNohoney » August 19th, 2019, 3:48 pm

~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...

hiriskpaul
Lemon Quarter
Posts: 3914
Joined: November 4th, 2016, 1:04 pm
Has thanked: 704 times
Been thanked: 1552 times

Re: Search and copy certain files please?

#245543

Postby hiriskpaul » August 19th, 2019, 6:14 pm

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:

TheMotorcycleBoy
Lemon Quarter
Posts: 3246
Joined: March 7th, 2018, 8:14 pm
Has thanked: 2226 times
Been thanked: 588 times

Re: Search and copy certain files please?

#245551

Postby TheMotorcycleBoy » August 19th, 2019, 6:42 pm

Just install a sensible OS, and hack something out on the command line with UNIX power tools...

:ugeek: 8-)

xeny
Lemon Slice
Posts: 450
Joined: April 13th, 2017, 11:37 am
Has thanked: 235 times
Been thanked: 154 times

Re: Search and copy certain files please?

#245561

Postby xeny » August 19th, 2019, 7:15 pm

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.

servodude
Lemon Half
Posts: 8406
Joined: November 8th, 2016, 5:56 am
Has thanked: 4486 times
Been thanked: 3615 times

Re: Search and copy certain files please?

#246184

Postby servodude » August 22nd, 2019, 8:14 am

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: No registered users and 36 guests