Management

Subscribe to Blog via Email

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 785 other subscribers

Social

  • LinkedIn
  • RSS Feed for Posts
  • Twitter
  • StumbleUpon

Move files to sub folders based upon year and month LastWriteTime [Solved]

Very often I hear my colleagues say that zipping, deleting or archiving a folder takes to many time, and resources of the server they are working on.

This is due to the large amount of files in these folders.

 

In order to help then I write this simple script, to move files based upon their LastWriteTime.

The scripts looks at the LastWriteTime, and creates subfolders based upon year and month.

 

Note:

When working with a large amount of files, the server can give the message: ‘Not responding’

This is due to excessive use of resources of the server.

 

Always be aware of the server you’re working on, and the time you’re using this script.

 

Copy the powershell script, to a location on your server, for example c:\scripts

 

In this example the folder with the large amount files is F:\Test

 

Start Powershell as an administrator

 

Change the directory to the location where the script is located C:\scripts\Copy-files-Year-Month

Execute the script :

.\Copy-files-Year-Month-v11.ps1

 

Fill in the location of the folder which contains the files.

 

This action can take a while based upon the amount of files to be moved.

 

All of the files are moved to the sub folders based upon year and month

Your now able to zip,archive of delete the files in smaller groups based upon one or more folders.

Download:

Copy-files-Year-Month-v11-uk

 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.