Ok, I come here completely cap in hand knowing almost next to nothing about scripting and having done nowt more with PS than open it up and fire off a few basic commands.
But from what I have read PS is the new daddy on the block regarding scripting and (in my mind at least) what I would need the script to do would be pretty simple (for someone who knows what they are doing with scripts anyway..........)
Basically I need a script(s) that can go through a directory and all its sub-directorys and output to a file any file that was modified before a particular date, or after a paticular date, or between particular dates.
To put the problem itself into context have just recently completed a server migration but for whatever reason some files that the users work on are more recent on the old server than the new, but as multiple users work on the same files sorting out what is what wont be an easy task (they are all just spreadsheet files afaik). What appears to have happened is some users have updated files on the new server where as others have updated on the old.
Thankfully both servers were only on the network together for about a week so the disparity of data wont be too out of hand and it also means the script will only need to deal with days in july.
Any help would be massively appriciated and will save hours and hours of work crawling through directorys and subdirectorys!!! (and may also begin to teach me a bit about scripting, I do want to learn but I dont think I can get up to speed in about 24 hours, which is about the sort of time frame I have to sort this out......!!!!
Thanks in advance!!!!!!!!
absolute beginner help please!!!!
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
absolute beginner help please!!!!
Ok, I come here completely cap in hand knowing almost next to nothing about scripting and having done nowt more with PS than open it up and fire off a few basic commands.
But from what I have read PS is the new daddy on the block regarding scripting and (in my mind at least) what I would need the script to do would be pretty simple (for someone who knows what they are doing with scripts anyway..........)
Basically I need a script(s) that can go through a directory and all its sub-directorys and output to a file any file that was modified before a particular date, or after a paticular date, or between particular dates.
To put the problem itself into context have just recently completed a server migration but for whatever reason some files that the users work on are more recent on the old server than the new, but as multiple users work on the same files sorting out what is what wont be an easy task (they are all just spreadsheet files afaik). What appears to have happened is some users have updated files on the new server where as others have updated on the old.
Thankfully both servers were only on the network together for about a week so the disparity of data wont be too out of hand and it also means the script will only need to deal with days in july.
Any help would be massively appriciated and will save hours and hours of work crawling through directorys and subdirectorys!!! (and may also begin to teach me a bit about scripting, I do want to learn but I dont think I can get up to speed in about 24 hours, which is about the sort of time frame I have to sort this out......!!!!
Thanks in advance!!!!!!!!
But from what I have read PS is the new daddy on the block regarding scripting and (in my mind at least) what I would need the script to do would be pretty simple (for someone who knows what they are doing with scripts anyway..........)
Basically I need a script(s) that can go through a directory and all its sub-directorys and output to a file any file that was modified before a particular date, or after a paticular date, or between particular dates.
To put the problem itself into context have just recently completed a server migration but for whatever reason some files that the users work on are more recent on the old server than the new, but as multiple users work on the same files sorting out what is what wont be an easy task (they are all just spreadsheet files afaik). What appears to have happened is some users have updated files on the new server where as others have updated on the old.
Thankfully both servers were only on the network together for about a week so the disparity of data wont be too out of hand and it also means the script will only need to deal with days in july.
Any help would be massively appriciated and will save hours and hours of work crawling through directorys and subdirectorys!!! (and may also begin to teach me a bit about scripting, I do want to learn but I dont think I can get up to speed in about 24 hours, which is about the sort of time frame I have to sort this out......!!!!
Thanks in advance!!!!!!!!
absolute beginner help please!!!!
You got it =)
get-childitem -path <insert directory here> -recurse | where{$_.lastwritetime -gt "7/1/2008"} > samplefile.txt
A few things:
- You can choose where the output file is going to go (ex. c:samplefile.txt). If there are spaces in the file directory, enclose the location in double quotes (ex. "c:documents and settingsmeserver migrationsamplefile.txt")
- The wonderful thing about PowerShell is that it has a very useful help feature to aid you in understanding the syntax. PowerShell was designed to encourage users to explore and better understand it. For example, type Get-Help Get-Childitem -detailed at the prompt to get not only an explanation of how Get-Childitem works, but examples of how to use it too. If you're not sure what the name of a cmdlet is, type Get-Command at the prompt and you will be given a list of all cmdlets available to you.
Hope this helps! Feel free to post questions, that's why we're here =)
get-childitem -path <insert directory here> -recurse | where{$_.lastwritetime -gt "7/1/2008"} > samplefile.txt
A few things:
- You can choose where the output file is going to go (ex. c:samplefile.txt). If there are spaces in the file directory, enclose the location in double quotes (ex. "c:documents and settingsmeserver migrationsamplefile.txt")
- The wonderful thing about PowerShell is that it has a very useful help feature to aid you in understanding the syntax. PowerShell was designed to encourage users to explore and better understand it. For example, type Get-Help Get-Childitem -detailed at the prompt to get not only an explanation of how Get-Childitem works, but examples of how to use it too. If you're not sure what the name of a cmdlet is, type Get-Command at the prompt and you will be given a list of all cmdlets available to you.
Hope this helps! Feel free to post questions, that's why we're here =)
absolute beginner help please!!!!
And if you want to only have the filename in the text file (and not other file info):
get-childitem -path <mypath> -recurse | where{$_.lastwritetime -gt "6/1/2008"} | format-table -property name > samplefile.txt
Also, since you're learning, I recommend using full commands as much as possible so that you can get used to powershell. So instead of using the ">" simple to output to file, use:| out-file samplefile.txt
get-childitem -path <mypath> -recurse | where{$_.lastwritetime -gt "6/1/2008"} | format-table -property name > samplefile.txt
Also, since you're learning, I recommend using full commands as much as possible so that you can get used to powershell. So instead of using the ">" simple to output to file, use:| out-file samplefile.txt
absolute beginner help please!!!!
wow =| a single line! do i take the -recurse switch takes care of the subdirectorys??
absolute beginner help please!!!!
Yup, -recurse is the subdirectories. If you ever want to look for hidden files and folders, the -force switch will take care of that.
absolute beginner help please!!!!
cool =D now am i correct that the -gt is for files greater than, what would be the switch for less than?
(not that im too lazy to find out, just too busy right now!!!)
....always the way, you need to find things out and learn when you have the least amount of time to address the problem!!!!
(not that im too lazy to find out, just too busy right now!!!)
....always the way, you need to find things out and learn when you have the least amount of time to address the problem!!!!