Dos command to cut files and paste


I am searching for a dos command which can cut files from a given folder and paste those files in to an Archive folder which sits along side with the files need to be uploaded into. There are folders with space in its name. I have to insert this command in a bat file. I use below code for my other tasks and its working fine, but it does not do cut and paste, it does copy and paste.

@echo off

echo Start Copy

set SOURCE_DIR=C:\Nat\Reports\Reports
set DEST_DIRS="X:\", "N:\Reports\Production Repts\Reports"
set FILENAMES_TO_COPY="2018All Projects_New.xlsx","2017Report_New.xlsx"

pushd "%SOURCE_DIR%"

for %%F in (%FILENAMES_TO_COPY%) do (

    for %%D in (%DEST_DIRS%) do (
        echo file "%%~F" to "%%~D"
        xcopy /Y "%%~F" "%%~D"



echo. Done.
exit /b

Thank you
Asatoma SadgamayaAnalystAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Alex GreenProject Systems EngineerCommented:
Move source destination

Nice and easy :D
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
As Alex says, use the move command. Here's the syntax
move "C:\Source with space" "C:\Dest with space" /Y

Open in new window

Asatoma SadgamayaAnalystAuthor Commented:
Hi Jeremy and Alex,

Thanks for your feedback, I really appreciate it.  I have edited my requirement.

(Jeremy the code you gave is not working for me. I have done a test based on what you have mentioned.)

move "C:\Users\A1\Desktop\kk" "C:\Users\A1\Desktop\kk\bb b" /Y

Please have a look.

Thank you
Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Sorry, my fault. I put the /Y in the wrong location. Also, it gets a little tricky if you're moving things into a sub folder of itself. See if this works for you:
md "C:\Users\A1\Desktop\kk\bb b"
move /Y "C:\Users\A1\Desktop\kk\*" "C:\Users\A1\Desktop\kk\bb b"

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Asatoma SadgamayaAnalystAuthor Commented:
Thanks Jeremy, that worked for me.

2 updates

1. I did *.xlsx*

md "C:\Users\A1\Desktop\kk\bb b"
move /Y "C:\Users\A1\Desktop\kk\*.xlsx*" "C:\Users\A1\Desktop\kk\bb b"

2. I change move to copy for another work. that worked

copy /Y "C:\Users\A1\Desktop\kk\*.xlsx*" "C:\Users\A1\Desktop\kk\bb b"

Thank you so much
Jeremy WeisingerSenior Network Consultant / EngineerCommented:
Glad to help. :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Windows Batch

From novice to tech pro — start learning today.