Home

Linux find files older than specific date

How To Find And Delete Files Older Than X Days In Linux

Hi I need to find the list of files in a directory and to do some specific operations based on the type of files. suppose in a directory am having .dat , .log, .err, .rej file types. i need to filter out .dat and .log only which are older than six months. i used the below query but the.. Hi, I need to find out list of files which are older than specific date. I am using 'find, and newer' commands but its not giving the correct result. Can you please help to findout the list of files. thanks (2 Replies

Using just the command line tools it was relatively simple but not obvious, so this is a note to self. The find utility has an option to find a file newer than another file. By creating an empty file with a specific creation date we can do the search: touch timestamp -d 2010-01-0 You can use -mtime option. It returns list of file if the file was last accessed N*24 hours ago. For example to find file in last 2 months (60 days) you need to use -mtime +60 option. -mtime +60 means you are looking for a file modified 60 days ago. -mtime -60 means less than 60 days. -mtime 60 If you skip + or - it means exactly 60 days. You. Delete Files Older Than x Days on Linux The find utility on linux allows you to pass in a bunch of interesting arguments, including one to execute another command on each file. We'll use this in order to figure out what files are older than a certain number of days, and then use the rm command to delete them

Is it possible on linux to find directories where all contained files and directories (and sub-directories' files etc.) are older than a given age? In other words, if a directory has one or more files within that have a modification date more recent than a given threshold, that directory should not be listed The Linux find command is a handy tool that lets you find or locate files on your system. You can specify to locate a file based on wide criteria such as file type, file location, and file permissions to mention a few. Additionally, you can find files changed in the last number of days How do you delete files older than specific date in Linux? VRK Published at Dev. 8. VRK I used the below command to delete files older than a year. find /path/* -mtime +365 -exec rm -rf {} \; But now I want to delete all files whose modified time is older than 01 Jan 2014 To find the files that have been modified N minutes ago, or with a modification date older than N, simply replace -mtime with -mmin. So if you want to find the files that have been changed (with the files data modification time older than) in the last N minutes from a directory and subdirectories, use: find /directory/path/ -mmin N -l Q. How to copy or Move the files and folder based on date modified on linux ? 1. Check the files modified date : 2. Create May directory under tmp, where the destination of the listed files : 3. Run the following command to display the files for date May 12 and Move it to /tmp/May folder : 4

1 Answer1. Active Oldest Votes. 38. You can do it with this command. find /path/to/files* -mtime +365 -exec rm {} \; Some explain. /path/to/files* is the path to the files. -mtime is used to specify the number of days old that the file is. +365 will find files older than 365 days which is one year. -exec allows you to pass in a command such as rm If you have a list of files, but you only want to delete files older the a certain date, for example, a maildir folder with 5 years worth of email, and you want to delete everything older then 2 years, then run the following command. find. -type f -mtime +XXX -maxdepth 1 -exec rm {} \; The syntax of this is as follows You can use the find command to search all files modified older than X days. And also delete them if required in single command. First of all, list all files older than 30 days under /opt/backup directory. find /opt/backup -type f -mtime +3 With this, you will be able with the Linux find command to find your JPG files older than 30 days and then execute rm or mv or whatever command you want on them. Find files older then find /path/to/files/ -type f -name '*.jpg' -mtime +

Find Files Older Than N Days We use the argument '-atime' of find command to find files older than N days, i.e. last accessed before at least N days. $ find <directory_path> -atime +<N> $ find. -atime +3 Find Files Older Than Specified Day To choose a more specific date range follow those steps, then click anywhere on the text in that box after the colon (so, for example, on this week) and a calendar will pop up. Click any date to search for files modified on that day. To search a range of dates, you have a few options: Click a date and drag your mouse to select the range

find - How do you delete files older than specific date in

You can delete all files and folders older than (with the file's data modification time older than) N days from a directory by using: find /directory/path/ -mindepth 1 -mtime +N -delete An explanation of the whole command and what you need to replace: find is the Unix command line tool for finding files (and more But first, let's play safe and show you a command to view the files older than X days, so you can review the list first before you launch the delete-command. $ find . -mtime +180 -print To break it down: we use find in the current directory (the dot .) and list all files with a modification date that's older than 180 days

How to find and delete files older than some particular

To search for files bigger than 4 GiB in the entire filesystem, run: $ find / -type f -size +4G. To know files bigger than X size in a specific directory, replace the dot (.) in the above command with the directory path like below. $ find Downloads/ -type f -size +4G. The above command find files bigger than 4 GiB in Downloads directory The first argument in the above command is the path to the files. The second argument is -mtime is used to specify how many days old the file is. If you enter +5, it will find files older than five days. The last argument is -exec allows you to pass in a command such as rm. The {} \; at the end is required to terminate the command There are a couple of ways you can delete one of them is to use the below two commands. Let me know if you have any specific requirements. # Below command list all Oct files and writes the output to a .tmp file find takes multiple selectors e.g. find files that were modified yesterday: find . -mtime +1 -mtime -3 so, older than 1 day but younger than 3. Works with ctime, atime, mmin etc as well. I think that's your ticket. You can chain all kinds of selection statements like that. ml

linux - Find files recursively that are older than one

In this case, we're going to look at the LastWriteTime for each file. In this example, I want to show all files older than 30 days. In order to do that, we have to get the current date with Get-Date, subtract 30 days and then grab everything less than (older than) the resulting date. Get-ChildItem | Where-Object {$_. LastWriteTime -lt (Get-Date) The Linux command utility find will allow us to perform arbitrary commands on files which are filtered by the command. Using this opportunity we can delete the files which are older than specified days by passing either command or action to find command. Find command syntax would look like, find <search> <criteria> <action> How to delete Continue reading How to delete files older than.

Find files modified in the last 7 days. First we need to get the the date for current day - 7 days and use it in the below command. forfiles /P directory /S /D + (today'date - 30 days) For example, if today's date is Jan 11th 2015, if we need to get the files modified in the last 7 days, you can use the below command find . -mtime -1 # find files modified less than 1 day ago # (i.e., within the past 24 hours, as before) find . -mtime 1 # find files modified between 24 and 48 hours ago find . -mtime +1 # find files modified more than 48 hours ago find . -mmin +5 -mmin -10 # find files modified between # 6 and 9 minutes ag The above find command was used to search for all files greater than specified size. Next, find command example will search for all files with less than 10 Kilobytes in size. Note the use of-sign: $ find . -size -10k Example 4 In this example we will use find command to search for files greater than 10MB but smaller than 20MB 16. The command seems ok and in my 11.10 it works. Haven't you missed the trailing slash in the destination folder? find /storage/current/dbdumps/ -type f -mtime +30 -exec mv ' {}' /storage/archive/dbdumps/ \; Other thing you may try is using /bin/mv insted of just mv. Share. Improve this answer Use the find command. The find command is probably one of the most used tools within the Linux operating system. It is extremely useful in interactive shells. It is also used in scripts. With find I can list files older or newer than a specific date, delete them based on that date, change permissions of files or directories, and so on

A while back we reviewed 15 practical find command examples (Part I).Find command can do lot more than just searching for files based on name. In this article (Part 2), let us discuss 15 advanced examples of find command including — finding files based on the time it is accessed, modified or changed, finding files comparatively, performing operation on found files etc. Find .sh and .txt Extension Files in Linux. Interpretation of the command above:. means the current directory-type option is used to specify file type and here, we are searching for regular files as represented by f-name option is used to specify a search pattern in this case, the file extensions-o means OR; It is recommended that you enclose the file extensions in a bracket, and also. The historic data for various linux distribution is stored in below directories: 1. Red Hat, Fedora, CentOS, and Scientific Linux should use the /var/log/sa directory. 2. Debian, Mint, and Ubuntu users should use the /var/log/sysstat directory. By default, sar stats are collected every 10 minutes. The data is collected using a simple cron job.

Find older files than specified date - UNI

  1. us signs to find files greater than or smaller than a specific timestamp. find /home -type f -name *.txt -mtime +5 Search for Files With Specific Permissions. The -perm option allows users to search for files with a particular set of permissions. find /home -type f -perm 77
  2. However, my intention was to answer the specific question: Is there a way to simply request a list of objects with a modified time <, >, = a certain timestamp? That basic question is how I ended up on this thread, and so I thought it reasonable to include an answer to it. The issue is labeled aws s3 ls - find files by modified date?
  3. In the above example the -lt stands for less than. If, however, you wished to find files with a modification time after a specific date, you could use -gt, instead.For instance, if I wished to see the list of files with a modification time after January 1, 2017 in the C:\windows\system32 directory, I could use the command below
  4. For example, you can define size 100K, 100M, 1G or 10G formats. Use below examples, which will help you to find files by there size and extension. Find all files larger than or equal to 100 MB under entire file system. find / -type f -size +100M. Find all files greater than 1 GB size in root file system. find / -type f -size +1G
  5. when the file was accessed in
  6. The find command in UNIX is a command line utility for walking a file hierarchy. It can be used to find files and directories and perform subsequent operations on them. It supports searching by file, folder, name, creation date, modification date, owner and permissions

easier to parse plain ls output than to deal with find when it recurses, finds those huge subtrees, and so on. I note your thread title is Copy Files Based On Date Modified And Move Them To Respective Folders In AIX, and your own script uses cp -p. Copy and move are very different commands. copy will give you duplicates o Linux find/copy FAQ: How can I use the find command to find many files and copy them all to a directory?. I ran into a situation this morning where I needed to use the Linux find command to (a) find all the MP3 files beneath my current directory and (b) copy them to another directory. In this case I didn't want to do a cp -r command or tar command to preserve the directory structure; instead.

find files older than a given file - The UNIX and Linux Forum

  1. 1. By Name. The find file by name is the most common way to practice the find command in the Linux operating system. We need to use the -name option with the find command. Note: While searching the file name, make sure the file name will correct. Because it is case sensitive
  2. Deleting files conditionally based on their age is sometimes useful. This tech-recipe describes a procedure for deleting aged files using the UNIX find command. The find command has a -newer expression which compares the found files against a reference file. It returns files with a modification time newer than the reference file. To find older [
  3. For example, to find all files that don't end in *.log.gz you would use: find /var/log/nginx -type f -not -name '*.log.gz' Find Files by Type # Sometimes you might need to search for specific file types such as regular files, directories, or symlinks. In Linux, everything is a file
  4. If you use -c option, and if a file doesn't exists, touch will not create the file. $ touch -c a.txt. Commands like ls command and find command uses these timestamp information for listing and finding files. You can also create more than 1 files from a single touch command. The following example will create 4 files named a, b, c, and d
  5. You can locate unused files by using the ls or find commands. For more information, see the ls (1) and find (1) man pages. Other ways to conserve disk space include emptying temporary directories such as the directories located in /var/tmp or /var/spool , and deleting core and crash dump files
  6. Delete Files Older Than X Days with File Explorer. Open the Search tools tab in the Ribbon (F3). Click on the Date modified button. It has a drop down list with options. Select the desired option, like Last week. File Explorer will filter the results immediately. Select the files you don't need, and press the Delete key to delete files
  7. utes Brenda333 over 4 years ago I'm wondering if a batch file could help to move all the files which i need from a couple of folders to a specific one, but only if there are older then 5
Editor@pambazuka

How To Find Files Newer Than A Specific Date Using Command

  1. Open File Explorer or type it into Cortana. Click a folder to be searched or select This PC. In the top right corner you will see a box that says Search and has a magnifying glass next to it. Type the text modified: into that box. A calendar will pop up and you can select a date or enter a date range to search
  2. utes, hours, days, or weeks by specifying the first letter of any of those words (e.g., 1w). age_stam
  3. Use the 'find' Command to Locate a File in Linux. The command used to search for files is called find . The basic syntax of the find command is as follows: find filename. The currently active path marks the search location, by default. To search the entire drive, type the following: find / filename. If, however, you want to search the folder.
  4. 11 ways to list and sort files on Linux Linux commands can provide details on files and show options for customizing file listings, but can also reach as deeply into a file system as you care to look
  5. WC command , short for Word Count, is a command line tool in Unix/Linux systems used for printing newlines, counting number lines & characters in a file. The command can also be combined with other piping operations for general counting functions. To count the number of files in a directory, use the syntax below. # ls -1 | wc -l

Find Files By Access, Modification Date / Time Under Linux

Solution. To search multiple subdirectories with the find command, but not all of them, specify their names at the beginning of the find command. For instance, if you want to search two folders named foo and bar for all *.java files, use this command: find foo bar -name *.java. And if you want to search three folders named foo, bar, and baz. This will find all files in the Pictures folder that are more than 1 day old and (force) remove them all. More options. 1. You can change the path to point to any folder. Make sure you use absolute path. 2. You can change the time interval. -mtime refers to number of days while -mmin refers to number of minutes. 3. You can set the time criteria The following windows script will move files older than a given date from C:\folder1 to C:\folder2. By older, I am assuming that they are not modified after a certain date.The date is passed in the format yyyymmdd.When files are moved to folder2, they are automatically deleted from folder1 Using the Ansible find module to search for files/folder. Ansible find module is used when you need to retrieve a list of files in the remote server which matches some conditions like name, size, etc. You will have to provide the path (s) to the remote server where the search should be done. It also supports searching for directories and links

Find and Locate commands are used to search for the files in the system while grep is used to search file based in the text that it contains. Find is a slower method but contains several search conditions while Locate does not include as many conditions but is much faster than the Find Removing files/folders older than X days. Removing files with a specific extension. There might be a scenario where you want to delete files by their extension types. Let's say .log file. We can find the extension of a file using the os.path.splitext(path) method. It returns a tuple containing the path and the extension of the file ), larger than than 100MB (-size +100M), don't descend directories on other filesystems (-xdev) and print the full file name on the standard output, followed by a new line (-print). xargs ls -lh - the output of the find command is piped to xargs which executes the ls -lh command that will print the output in long listing human-readable format -mtime tells Linux to search files with timestamp in terms of date. Here, +5 indicates search the files older than 5 days. exec command is executed if files match above criteria. rm command is used to delete the matching files {} ; fetches all the matching files of find command and serves input to rm command one by one. Code in vi-editor: 5.

To display the text file is outdated for each of the files in the current directory that are older than January 1, 2007, type: forfiles /S /M *.* /D -01/01/2007 /C cmd /c echo @file is outdated. To list the file name extensions of all the files in the current directory in column format, and add a tab before the extension, type We can use the find module to retrieve all the files that are older than a particular time and then delete those files using file module. This can be helpful when dealing with logs. In the following example, the first task finds all files older than 5 days *PATCH v27 00/10] NTFS read-write driver GPL implementation by Paragon Software @ 2021-07-29 13:49 Konstantin Komarov 2021-07-29 13:49 ` [PATCH v27 01/10] fs/ntfs3: Add headers and misc files Konstantin Komarov ` (11 more replies) 0 siblings, 12 replies; 24+ messages in thread From: Konstantin Komarov @ 2021-07-29 13:49 UTC (permalink. MegaN64 is a Nintendo 64 emulator with which you can play every Nintendo 64 game right on your Android: Super Smash Bros, Pokemon Stadium, Mario Kart 64, Zelda: Ocarina of time, Resident Evil 2, Doom 64, and dozens of others. An emulator can easily reproduce the functions of any working machine. PPSSPP is one of the most feature-packed PS2 Emulator, and it can quickly transform your Android.

too - linux find files older than specific date . How to delete all files older than 3 days when Argument list too long? (2) Another solution for the original question, esp. useful if you want to remove only SOME of the older files in a folder, would be smth like this: find . -name *.sess -mtime +100. Finding Files by Age - Locating Old Files on Your Server , finding any files modified in the past 3 days, finding .txt files modified in the past 3 days, find files by size, finding files larger than 10,000k, finding .txt files < 3 days old and delete them, dealing with permission denied in find, finding a string within a text file, finding the full directory path for a command, find the. I ran the script. It ran and created the CSV file, however, the CSV is blank. I know there are OST's in a hidden folder inside each user folder in the network share. I ran the same script minus the logic for find only files older than 29 days and it populated the CSV. Not sure why it isn't populating the CSV now. Any ideas

Part 4: Selecting files using their age. Introduction. Usage in metadata search. Usage of the reference file instead of time period. Using last usage of the file date as the criteria for finding files. Specifying the time period from the beginning of today, rather than from the current moment In the same find exec example to store the output to a file # find /tmp/ -type f -exec md5sum {} \; > /root/checksum_datababse.out . Find exec example 2: Remove files older than certain time. In the below find exec example we will list files older than 5 days # find /tmp/ -type f -mtime +5 -exec ls -l {} \; To remove files older than 5 day

Using find to show files above a certain size (1,000,000 bytes = 1M) find . -type f -size +1000000 -ls. In the above commands, the -ls command will display the file size, date, and other attributes regarding the file. If you would like just the path and filename, then omit the -ls. find Linux There is a command in Linux to search for files in a directory hierarchy known as 'find'. It searches the directory tree rooted at each given starting-point by evaluating the given expression from left to right, according to the rules of precedence, until the outcome is known (the left-hand side is false for and operations, true for or), at. find files modified in the last hour or day - very useful for finding most recently updated log files verify if a certain file was accessed and when - useful when debugging a script quickly get the list of really old files (not updated for longer than 30 days or something like that 7. Search across multiple files. Grep can do much more than just search the contents of a specific file. You can use what's known as a recursive search to cover entire directories, subdirectories. Script as follows: Just need to check if the files are older by creation date than 0ne hour and ignore the other folders in there. ###CHANGE LOG ###Created to notify ICT if the ESH Import process on OPENAPP has failed and needs manually restarting

Delete files older than 30 days. 1. find . -mtime +30 -exec rm {} \; 1. Save the deleted files to a log file. 1. find /home/a -mtime +5 -exec ls -l {} \; > mylogfile.log. This way, you'll get a line at top with the date the line is executed (also a line at the bottom). The last two semicolons are necessary, one is for find and one for bash Unlike older versions, in which the GUI search feature was less accurate and efficient than the terminal search commands, Ubuntu 20.04 has greatly improved this feature. Now, the search screen differentiates between different search sources more cleanly, helping you find the app, file, or setting you require much more quickly Sorting using each of these file properties can be enabled by using a specific flag. In this brief ls command guide, we will look at how to sort the output of ls command by last modification time (date and time). Let us start by executing some basic ls commands. Linux Basic ls Commands. 1

Finding a file in a Linux system can be difficult if you don't know how. The best way to find files is to utilize several different terminal commands. Mastering these commands can give you complete control over your files, and they are much more powerful than the simple search functions on other operating systems Note that sizes are listed in bytes (B), megabytes (MB), gigabytes (GB), or terabytes (TB) when the file or directory's size is larger than 1024 bytes. List files including hidden files. Type the ls -a command to list files or directories including hidden files or directories. In Linux, anything that begins with a . is considered a hidden file Windows 10 tip: Search for any file by date. To change the value, click the operator in the search box and use the calendar control to pick a specific date or drag to select a range of dates. the file /test_script/test_file will be successfully removed. Create the Script. Now using the previous command we will create a script called delete_old_files.sh, this file will take care of removing the files that are located at /test/my_folder and are older than 7 days. #!bin/sh find /test/my_folder -type f -mtime +7 -exec rm {} + Add the.

Delete Files Older Than x Days on Linu

If more than one of -H, -L and -P is specified, each overrides the others; the last one appearing on the command line takes effect. Since it is the default, the -P option should be considered to be in effect unless either -H or -L is specified.GNU find frequently stats files during the processing of the command line itself, before any searching has begun. . These options also affect how those. In smaller projects, you can simply do this in a text editor and search for the date you want, then find a good commit sha-1 hash to checkout (i.e. git log > log.txt; emacs log.txt). Another somewhat canonical way is to use git-rev-list Dir Command Options. Item. Explanation. drive : , path, filename. This is the drive , path, and/or filename that you want to see results for. All three are optional since the command can be executed alone. Wildcards are allowed. See the Dir Command Examples section below if this isn't clear. /a Possible Duplicate: How do I delete files greater than a certain date on linux How to delete all files in current directory and it`s sub directories older than one year? Stack Exchange Network Stack Exchange network consists of 178 Q&A communities including Stack Overflow , the largest, most trusted online community for developers to learn. Batch script to remove files older than based on the extension of the file. Batch to delete all files. Batch to delete files older than based on the extension. In this example, we will configure the script to delete old files with .bak. Copy the below command and past in text file. Save as delete.bat. Save anywhere except D:\Backup\

DATA DUMP: April 2008

For this particular example, fd is approximately nine times faster than find -iregex and about five times faster than find -iname. By the way, both tools found the exact same 20880 files . Finally, let's run fd without --hidden and --no-ignore (this can lead to different search results, of course) Use PowerShell to Find Metadata from Photograph Files; There are three basic properties of a file that I commonly use when looking at files that are neglected. The first is the date it was created, the second is when it was modified, and last is when it was accessed. These properties are visible when I to go the General tab of a file in File.

linux - Find directories with all files inside older than

11. This find command in linux checks all the files with test.txt which is owned by a particular group. find / -group fastweb host -name test.txt Find command to search the modified date & time of a particular file( In Days) 12. This command search for the files which were modified more than 90 days back. find / -ctime +90 test.txt 13 If you're interested only in a specific file type, specify it this way in the command: Get-ChildItem C:\ -recurse -include *.exe Windows Command Prompt. In Command Prompt, forfiles command is used for batch processing a command on a file or set of files. The following command will find and list all files that are larger than 500MB in the C. To delete the files found in the search, replace echo with del in the command. ForFiles /p z:\OneDrive /s /m *.PDF /d -365 /c cmd /c del @file. If you need to do this frequently or on different computers, you can put it in a batch file so you can run it by double-clicking it Specifies the maximum file age (to exclude files older than N days or date). /minage:<N> Specifies the minimum file age (exclude files newer than N days or date). /maxlad:<N> Specifies the maximum last access date (excludes files unused since N). /minlad:<N> Specifies the minimum last access date (excludes files used since N) If N is less than.

Linux Find Files Modified in Last Number of Day

To search for files older than particular number of days, use plus sign followed by the number of days For example to find files in /data directory older then one year (and this candidates for archiving or deletion) use: find /data -type f -mtime +365 -ls. To find files that haven't been changed in more than one day Warning: Once the encrypt feature is enabled, Linux versions older than 4.1 will be unable to mount the file system. Also, Linux versions older than 5.5 will be unable to mount the file system if its block size (tune2fs -l /dev/device | grep 'Block size') differs from the system page size (getconf PAGE_SIZE) (normally both are 4096 and this is not a problem) For a system administrator, working with text files is a common phenomenon. Depending on the number of files you have to perform a search on, there are two ways to perform the text search: automated or manual. It's possible using both built-in tools and 3rd-party apps. In this article, how to find texts in files in Linux is explained Linux operating system and related technologies and tools provide modification time of the files, folders, executables etc. mtime is an attribute used by files, directories and different type of files like text, binary etc. In this tutorial, we will learn how to use mtime attribute with Linux find and related commands.. Modification Time (mtime

2. How to search file by name. If you want, you can use the find command to search for a specific file by its name. The -name command line option lets you do this. Here's the syntax: find [dir-path] -name [filename] For example, the following command will search the current directory for a file named 'testfile1.txt.' If I use this below command, I am able to delete only the files and files in sub-folders older than 10 day, forfiles /p D:\Testing\Sample /s /d -10 /c cmd /c del /s /q @file When pulling files from an rsync older than 3.0.0, you may need to use this option if the sending side has a symlink in the path you request and you want the implied directories to be transferred as normal directories.-b, --backup. With this option, preexisting destination files are renamed as each file is transferred or deleted I ran into an article on Hey Scripting Guys that showed how to remove files over seven (7) days old from a folder. It showed this line in PowerShell to get a list of the files ending in .LOG: Get-Childitem C:\Foldername\*.LOG. It then showed two additional lines to remove that content

FORFILES.exe Select a file (or set of files) and execute a command on each file. Batch processing. Syntax FORFILES [/p Path] [/m SrchMask] [/s] [/c Command] [/d [+ | -] {date | dd}] Key /p Path The Path to search (default=current folder) /m SrchMask Select files matching the specified search mask Wildcards are literal (non standard): A mask of -m * will iterate all files (this is the default. In this quick tip I am going to show you to delete or copy files with names that contain strange characters on Linux. Sample file list. Here is a sample list of file names: The problem and solution. Your default bash shell considers many of these special characters (also known as meta-characters) as commands. If you try to delete or move/copy. $ find . -perm /220 $ find . -perm /u+w,g+w $ find . -perm /u=w,g=w All three of these commands do the same thing, but the first one uses the octal representation of the file mode, and the other two use the symbolic form. The files don't have to be writable by both the owner and group to be matched; either will do Find command will find all files and directories owned by a specific user and execute rm command to remove them. The following linux command will find and remove all files within /home/ directory owned by a user student. The following linux command is executed as root user: NOTE: replace /home with your target directory. However, if you are. I needed to be able to delete files left on an FTP server I run that are older than two months and to accomplish that I used the FORFILES command that came out with Windows 7 and Server 2008. I have been doing this type of scripting for a long time but was unfamiliar with FORFILES, so if you are like me you will find that bringing up a CMD and. With the help of this command, we can find the properties of file such as file size, permissions, modified date, etc. Use the following command line to list the files and directories. stat -c '%A %n' * 6. Listing Directories Using Grep Command. This command is used for searching text files using regular expressions. To list the contents of the.