Solved

Need a script file to create a new folder and move contents from old location

Posted on 2014-01-21
4
837 Views
Last Modified: 2014-01-23
I have a few thousand folders with .pdf and .mov files in them. Some of the folders only have one file or the other as well.   I need to move the .mov files to a network share but I need the same folder name that the file is in now, to be created on the network share, and then the .mov files to be moved into that folder.   I need the old folder to stay if it has a .pdf(s) in it, but be deleted it if only had .mov files in it and is now empty.  These .mov files are not movies but medical documentation.  :)
Thanks for any guidance.
0
Comment
Question by:digital0g1c
4 Comments
 
LVL 18

Accepted Solution

by:
Dennis Aries earned 500 total points
ID: 39799294
How about simply using xcopy?

To copy all files recursively excluding pdf-files:
xcopy <source> <destination> /EXCLUDE:.pdf /S /I  

Open in new window


Delete all .mov-files recursively
del /S *.mov

Open in new window


Delete all empty directories:
Create a bat-file with the following line:
for /f "usebackq" %%d in (`"dir /ad/b/s | sort /R"`) do rd "%%d"

Open in new window


this will remove all empty directories recursively (taken from MSDN)
0
 
LVL 53

Expert Comment

by:Bill Prew
ID: 39799740
Is there just one level of folders, or are there folders withing the folders?

~bp
0
 
LVL 1

Author Closing Comment

by:digital0g1c
ID: 39804336
This worked great.   One thing is in the /EXCLUSION:.pdf needs to be /EXCLUSION:file.txt where file.txt is just a text file that has the exclusion files one per line like .pdf .txt ,etc.  Worked great though!  Thanks for your help!
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article will shed light on the latest trends when it comes to your resume building needs. For far too long, the traditional CV format has monopolized the recruitment market.
FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now