Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2014-01-21
4
Medium Priority
?
851 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 18

Accepted Solution

by:
Dennis Aries earned 2000 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 57

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

The Ideal Solution for Multi-Display Applications

Check out ATEN’s VS1912 12-Port DP Video Wall Media Player at InfoComm 2017. Kerri describes how easy it is to design creative video walls in asymmetric layouts and schedule detailed playlists ahead of time with its advanced scheduling feature.

Question has a verified solution.

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

Sometimes clients can lose connectivity with the Lotus Notes Domino Server, but there's not always an obvious answer as to why it happens.   Read this article to follow one of the first experiences I had with Lotus Notes on a client's machine, my…
Windows Server 2003 introduced persistent Volume Shadow Copies and made 2003 a must-do upgrade.  Since then, it's been a must-implement feature for all servers doing any kind of file sharing.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
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…

722 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