Jump to content

Batch copy files in orderly manner

war4sure

To help you understand what is my problem I present you this

 

Spoiler

Ril66n9.jpg

 

As highlighted in the picture, there's 342 songs in that folder which is destined for my car audio and that number is expected to get higher every passing month.

Now this is where my problem starts.

 

My car audio plays songs in order of who's get copied first, and it doesn't matter if it looks like it was in orderly manner after copying them in the folder because if a song finishes copying before the other song that supposed to play before it does then that song will play first. To make it easy for you to understand,here's an example: If song number 10 finished it's copy before song number 9 did then song number 10 will play where song number 9 should been. Since this problem happens when I select all songs and copied all of it to the car audio folder, I had no choice but to copy all of the songs into my car audio folder one by one and it took almost an hour.

 

So, is there a way that I can use to copy large amount of files in a way so that it copies the files one by one in name order(it means until that file is finished the other files will not be copied and it's done so that file number 1 is copied before file number 2 is copied)?

 

Link to comment
Share on other sites

Link to post
Share on other sites

can you play a playlist in the car? that would be easier, then you can change the order as you see fit

 

what ordering parameters are you looking at?

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, BubblyCharizard said:

can you play a playlist in the car? that would be easier, then you can change the order as you see fit

 

what ordering parameters are you looking at?

The ordering needs to be done in namely fashion. Like song number 1 first before song number 2 and so on.

And unfortunately my car audio don't have a playlist function so got to play it that way.

Link to comment
Share on other sites

Link to post
Share on other sites

@echo off

set /A file=1
set /A add=1



for /f %%A in ('dir /a-d-s-h /b ^| find /v /c ""') do set cnt=%%A
echo File count = %cnt%


:1

if %file% equ %cnt% (
pause
)

if exist C:\users\axelb\Desktop\target\%file%.txt (
    echo no copy
    set /a file+=%add%
    goto 1
) else (
    echo copy
    copy %file%.txt C:\users\axelb\Desktop\target
    goto 1
)

pause

either this will work perfectly for you or not at all, atleast copies all the files then stops when there are none left. you could add a time delay or pause each time it copies if you want to make sure they get in the right order if this dosent cut it

I spent $2500 on building my PC and all i do with it is play no games atm & watch anime at 1080p(finally) watch YT and write essays...  nothing, it just sits there collecting dust...

Builds:

The Toaster Project! Northern Bee!

 

The original LAN PC build log! (Old, dead and replaced by The Toaster Project & 5.0)

Spoiler

"Here is some advice that might have gotten lost somewhere along the way in your life. 

 

#1. Treat others as you would like to be treated.

#2. It's best to keep your mouth shut; and appear to be stupid, rather than open it and remove all doubt.

#3. There is nothing "wrong" with being wrong. Learning from a mistake can be more valuable than not making one in the first place.

 

Follow these simple rules in life, and I promise you, things magically get easier. " - MageTank 31-10-2016

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, Bananasplit_00 said:

@echo off

set /A file=1
set /A add=1



for /f %%A in ('dir /a-d-s-h /b ^| find /v /c ""') do set cnt=%%A
echo File count = %cnt%


:1

if %file% equ %cnt% (
pause
)

if exist C:\users\axelb\Desktop\target\%file%.txt (
    echo no copy
    set /a file+=%add%
    goto 1
) else (
    echo copy
    copy %file%.txt C:\users\axelb\Desktop\target
    goto 1
)

pause

either this will work perfectly for you or not at all, atleast copies all the files then stops when there are none left. you could add a time delay or pause each time it copies if you want to make sure they get in the right order if this dosent cut it

How do I use this?

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, war4sure said:

How do I use this?

oh yah i should probably tell you that too. put the file in the source, specify the target here:

    copy %file%.txt C:\users\axelb\Desktop\target

and here:

if exist C:\users\axelb\Desktop\target\%file%.txt (

just change my file path to whatever yours is.

 

now to the tricky part, you have to name your files, every one of them, to the numbers of the order you want them copied. yep. couldent get past that with batch, might be me being a bit of a noob or there is legit no way. you can probably make a script that does that for you but i dont have time to make one for you tbh. then just run it and it should copy them all in order. if you still have problems with files loading in out of order add in some way to pause it here:

) else (
    echo copy
    copy %file%.txt C:\users\axelb\Desktop\target
    goto 1

there are loads of ways but i dont remember any of them atm. a song is atleast a minute long so just put a 1min timer or something there and it should be good. good luck

I spent $2500 on building my PC and all i do with it is play no games atm & watch anime at 1080p(finally) watch YT and write essays...  nothing, it just sits there collecting dust...

Builds:

The Toaster Project! Northern Bee!

 

The original LAN PC build log! (Old, dead and replaced by The Toaster Project & 5.0)

Spoiler

"Here is some advice that might have gotten lost somewhere along the way in your life. 

 

#1. Treat others as you would like to be treated.

#2. It's best to keep your mouth shut; and appear to be stupid, rather than open it and remove all doubt.

#3. There is nothing "wrong" with being wrong. Learning from a mistake can be more valuable than not making one in the first place.

 

Follow these simple rules in life, and I promise you, things magically get easier. " - MageTank 31-10-2016

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

19 hours ago, Bananasplit_00 said:

oh yah i should probably tell you that too. put the file in the source, specify the target here:


    copy %file%.txt C:\users\axelb\Desktop\target

and here:


if exist C:\users\axelb\Desktop\target\%file%.txt (

just change my file path to whatever yours is.

 

now to the tricky part, you have to name your files, every one of them, to the numbers of the order you want them copied. yep. couldent get past that with batch, might be me being a bit of a noob or there is legit no way. you can probably make a script that does that for you but i dont have time to make one for you tbh. then just run it and it should copy them all in order. if you still have problems with files loading in out of order add in some way to pause it here:


) else (
    echo copy
    copy %file%.txt C:\users\axelb\Desktop\target
    goto 1

there are loads of ways but i dont remember any of them atm. a song is atleast a minute long so just put a 1min timer or something there and it should be good. good luck

Okay, do I need to save this as a .bat file and place it the folder where I keep all my car music?

Also the car audio folder is actually in a USB stick so do I have to set it as the target?

And does the way I name my songs(refer the pic in my first post) works with this method?

 

Sorry if I asked too much questions,I just need to make sure.

Link to comment
Share on other sites

Link to post
Share on other sites

25 minutes ago, war4sure said:

Okay, do I need to save this as a .bat file and place it the folder where I keep all my car music?

Also the car audio folder is actually in a USB stick so do I have to set it as the target?

And does the way I name my songs(refer the pic in my first post) works with this method?

 

Sorry if I asked too much questions,I just need to make sure.

Yes

Yes

Doubt it

I spent $2500 on building my PC and all i do with it is play no games atm & watch anime at 1080p(finally) watch YT and write essays...  nothing, it just sits there collecting dust...

Builds:

The Toaster Project! Northern Bee!

 

The original LAN PC build log! (Old, dead and replaced by The Toaster Project & 5.0)

Spoiler

"Here is some advice that might have gotten lost somewhere along the way in your life. 

 

#1. Treat others as you would like to be treated.

#2. It's best to keep your mouth shut; and appear to be stupid, rather than open it and remove all doubt.

#3. There is nothing "wrong" with being wrong. Learning from a mistake can be more valuable than not making one in the first place.

 

Follow these simple rules in life, and I promise you, things magically get easier. " - MageTank 31-10-2016

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, Bananasplit_00 said:

Yes

Yes

Doubt it

Well, I tried. Plugged another usb stick to simulate the one I use and ran the script. What I got was a .bat file that seems to be on a infinite loop.No files is copied at all. Here's what I do:

Spoiler

set /A file=1
set /A add=1



for /f %%A in ('dir /a-d-s-h /b ^| find /v /c ""') do set cnt=%%A
echo File count = %cnt%


:1

if %file% equ %cnt% (
pause
)

if exist K:\ (
    echo no copy
    set /a file+=%add%
    goto 1
) else (
    echo copy
    copy %file%.txt K:\
    goto 1
)

pause

 

 

Anything that I did wrong?

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, war4sure said:

Well, I tried. Plugged another usb stick to simulate the one I use and ran the script. What I got was a .bat file that seems to be on a infinite loop.No files is copied at all. Here's what I do:

  Hide contents


set /A file=1
set /A add=1



for /f %%A in ('dir /a-d-s-h /b ^| find /v /c ""') do set cnt=%%A
echo File count = %cnt%


:1

if %file% equ %cnt% (
pause
)

if exist K:\ (
    echo no copy
    set /a file+=%add%
    goto 1
) else (
    echo copy
    copy %file%.txt K:\
    goto 1
)

pause

 

 

Anything that I did wrong?

 

did you name all your files to 1, 2, 3 and so on?

I spent $2500 on building my PC and all i do with it is play no games atm & watch anime at 1080p(finally) watch YT and write essays...  nothing, it just sits there collecting dust...

Builds:

The Toaster Project! Northern Bee!

 

The original LAN PC build log! (Old, dead and replaced by The Toaster Project & 5.0)

Spoiler

"Here is some advice that might have gotten lost somewhere along the way in your life. 

 

#1. Treat others as you would like to be treated.

#2. It's best to keep your mouth shut; and appear to be stupid, rather than open it and remove all doubt.

#3. There is nothing "wrong" with being wrong. Learning from a mistake can be more valuable than not making one in the first place.

 

Follow these simple rules in life, and I promise you, things magically get easier. " - MageTank 31-10-2016

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

27 minutes ago, Bananasplit_00 said:

did you name all your files to 1, 2, 3 and so on?

No. it's like this

(1)Artist - Song name

Link to comment
Share on other sites

Link to post
Share on other sites

47 minutes ago, war4sure said:

No. it's like this

(1)Artist - Song name

yah im pretty sure that wont work, i think i could make you something that copies them all, renames them correctly, and then copies. im at school so that might take a while and i might not be able to do it for you at all. but if you are fine with it the artist and song name can be in the metadata and the file be named 1, 2, 3 and so on. it looks for files named 1, 2, 3, 4 and so on then copies them in order so if the names arent just that it wont work. batch script is really stupid and i dont know a way to pick out just a single character of a file name like i would have to with your nameing scheme

I spent $2500 on building my PC and all i do with it is play no games atm & watch anime at 1080p(finally) watch YT and write essays...  nothing, it just sits there collecting dust...

Builds:

The Toaster Project! Northern Bee!

 

The original LAN PC build log! (Old, dead and replaced by The Toaster Project & 5.0)

Spoiler

"Here is some advice that might have gotten lost somewhere along the way in your life. 

 

#1. Treat others as you would like to be treated.

#2. It's best to keep your mouth shut; and appear to be stupid, rather than open it and remove all doubt.

#3. There is nothing "wrong" with being wrong. Learning from a mistake can be more valuable than not making one in the first place.

 

Follow these simple rules in life, and I promise you, things magically get easier. " - MageTank 31-10-2016

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×