Syntax of the find command provides options, string to search and file or drive or path to be searched. Help information about the find command can be printed with the /? option like below. Windows find command is very simple and easy command to work. Linux also have a command with the same name but it is used to search files and folders names not file contents. :: at least one file newer than the specified date.Windows operating systems provide the tool named find to search text files for a given term or string.
:: If the new-file-log exists after we're all done, then it means there is :: the file information into the new-file-log. :: each file if the files date is not equal to the specific date then echo :: Use 'forfiles' to find all files that are >= the specific date, and for :: greater than OR EQUAL to the current date. :: Windowsfile interface will only tell you if a file is So I just created a little helper function :getNum that drops leading zeros. It doesn't it reads the value as octal - don't repeat the mistake of my first attempt. My first attempt was to use /A thinking it drops the leading zeros. However, the date from FORFILES does not use leading zeros so I need to translate by dropping leading zeros. Moreover, if I wanted to know which files are newer, I can view the contents of the output file.įinally, my input was parsed from a file that used a date format of MM/DD/YYYY, meaning it would be for July first. I can then check for existence of the output file to determine if any files in the current directory are greater than the input date. That means the output file only has entries for files that are > _date_. And for each file I check if the modification date is _date_, and print the output to a file if and only if it is not equal.
That gives us all files with a modification date that is >= _date_. I created a function that ran forfiles for a particular date. The input date was a variable, and so I didn't want to go through a bunch of hoops/loops to calculate date + 1 day (think about logic for last day of month or last day of year). I used forfiles, however I noticed that it gave >= rather than just >.