+ Post New Thread
Results 1 to 2 of 2
Scripts Thread, PowerShell - Renaming a specific file of a certain extension within a folder in Coding and Web Development; Hi I'm wondering whether it's possible using PowerShell to rename a file based on it's extension and age!? To explain ...
  1. #1
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    604
    Thank Post
    68
    Thanked 17 Times in 16 Posts
    Rep Power
    20

    PowerShell - Renaming a specific file of a certain extension within a folder

    Hi

    I'm wondering whether it's possible using PowerShell to rename a file based on it's extension and age!?

    To explain in a little more detail. I have a folder which contains a number of files called "Text.dll.Date.RandomNumbers.old" however, I only want to rename the latest version of these files. I'm sure there must be a way around it!?

    I'm thinking it starts with "get-childItem "\\FileLocation\*.old |........"?

  2. #2
    randle's Avatar
    Join Date
    Dec 2006
    Location
    Chelmsford, Essex
    Posts
    604
    Thank Post
    68
    Thanked 17 Times in 16 Posts
    Rep Power
    20
    Turns out you can do this by using the following code
    Code:
    gci path | sort LastWriteTime | select -last 1



SHARE:
+ Post New Thread

Similar Threads

  1. Replies: 10
    Last Post: 23rd January 2013, 01:30 PM
  2. RM KLP & Powershell/VBScript - Automated Upload/download Of Files?
    By GShakespeare in forum Virtual Learning Platforms
    Replies: 1
    Last Post: 12th July 2012, 02:44 PM
  3. File restriction of a specific file in LAN
    By karna_gk77 in forum Windows Server 2000/2003
    Replies: 16
    Last Post: 19th March 2011, 09:34 PM
  4. Allow File Downloads through Certain Sites
    By sarchs in forum Windows
    Replies: 1
    Last Post: 15th January 2008, 02:20 PM
  5. VBS Change File on a Certain Line?
    By Samson in forum Scripts
    Replies: 7
    Last Post: 31st August 2007, 11:52 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •