Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Delete from supplied list of files Post 302511224 by ctsgnb on Wednesday 6th of April 2011 08:07:16 AM
Old 04-06-2011
In the above example, the find is launched for each and every nodes (not optimal).

So another way that "may" be faster (but ok, it may depends on some other stuff off course) is to generate a big list of inode/file once and then grep the matching inode from it

Code:
find $YOUR_SEARCH_PATH -exec ls -di {} + >ifile.lst 2>/dev/null

Code:
fgrep inode.list ifile.lst

or
Code:
grep -f inode.list ifile.lst

and the grep the filename from that list based on inode matching.

Last edited by ctsgnb; 04-06-2011 at 10:39 AM..
This User Gave Thanks to ctsgnb For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

unix question: user supplied input for 'alias'

I have a program to scan the log files and I want to pipe the output to 'less'. I want to create an alias such that following are equivalent scanlog chunky.lst = /udd/n2man/utils/scanlog chunky.lst|less where chunky is user supplied file which can change. Is this possible as an alias or... (1 Reply)
Discussion started by: ospreyeagle
1 Replies

2. AIX

Get the list, filter and delete the files on remote server

Hi, I need to login to a remote server. Go to a particular path. Get the lists of files on that path.There may be n number of files. I need to delete only those files from above created list which are 7 days older. I have achieved above using ftp protocol, but now the constraint has... (0 Replies)
Discussion started by: mail_amitnagpal
0 Replies

3. Shell Programming and Scripting

Delete old files but with exclusion with file list

Hello Can you please help and check what im missing on script below the goal is to delete the old files more than 7 days old but not the excluded file list inside excluded.dat file #!/bin/sh EXCLUDE=/path/to/exclude/exclude.dat FIND=/bin/find for xfile in '(read $EXCLUDE)' do $FIND... (9 Replies)
Discussion started by: angst_nu
9 Replies

4. Programming

Checking which arguments are supplied

I have written this C++ program and I am using getopt_long and (0 Replies)
Discussion started by: kristinu
0 Replies

5. Programming

Checking which arguments are supplied

I have written this C++ program and I am using getopt_long (2 Replies)
Discussion started by: kristinu
2 Replies

6. Programming

Checking which arguments are supplied

I have written this C++ program and I am using getopt_long and want to chech when the user supplies the arguments so that I can put a default or otherwise. Currently I am using hasargv or Pc.get_string("key",s), Pc.get_real("key",s), etc to detect whether the user supplied a value. For... (3 Replies)
Discussion started by: kristinu
3 Replies

7. UNIX for Advanced & Expert Users

Help with a shell script? List files, delete them and log them

Hello, i'm trying to solve this script. List, one at a time, all files larger than 100K in the /home/username directory tree. Give the user the option to delete or compress the file, then proceed to show the next one. Write to a logfile the names of all deleted files and the deletion times. I... (7 Replies)
Discussion started by: jose2802
7 Replies

8. Shell Programming and Scripting

Script needed to delete to the list of files in a directory based on last created & delete them

Hi My directory structure is as below. dir1, dir2, dir3 I have the list of files to be deleted in the below path as below. /staging/retain_for_2years/Cleanup/log $ ls -lrt total 0 drwxr-xr-x 2 nobody nobody 256 Mar 01 16:15 01-MAR-2015_SPDBS2 drwxr-xr-x 2 root ... (2 Replies)
Discussion started by: prasadn
2 Replies

9. Shell Programming and Scripting

List and Delete Files which are older than 7 days, but have white spaces in file name

I need to list and delete all files in current older which are olderthan 7 days. But my file names have white spaces. Before deleting I want to list all the files, so that I can verify.find . -type f -mtime +7 | xargs ls -l {} But the ls command is the working on the files which have white... (16 Replies)
Discussion started by: karumudi7
16 Replies

10. Shell Programming and Scripting

Changing information supplied when running file

In unix systems I can call `file` to return me the file type. file cel.vik $ cel.vik: ASCII text How can I append additional information when I create a file such that when I call `file` it returns me that additional information. (2 Replies)
Discussion started by: kristinu
2 Replies
xfs_ncheck(8)						      System Manager's Manual						     xfs_ncheck(8)

NAME
xfs_ncheck - generate pathnames from i-numbers for XFS SYNOPSIS
xfs_ncheck [ -i ino ] ... [ -f ] [ -s ] [ -l logdev ] device xfs_ncheck -V DESCRIPTION
xfs_ncheck with no -i arguments generates an inode number and pathname list of all files on the given filesystem. Names of directory files are followed by /.. The output is not sorted in any particular order. The filesystem to be examined is specified by the device argument, which should be the disk or volume device for the filesystem. Filesystems stored in files can also be checked, using the -f flag. OPTIONS
-f Specifies that the filesystem image to be processed is stored in a regular file at device (see the mkfs.xfs -d file option). This might happen if an image copy of a filesystem has been made into an ordinary file. -l logdev Specifies the device where the filesystem's external log resides. Only for those filesystems which use an external log. See the mkfs.xfs -l option, and refer to xfs(5) for a detailed description of the XFS log. -s Limits the report to special files and files with setuserid mode. This option may be used to detect violations of security pol- icy. -i ino Limits the report to only those files whose inode numbers follow. May be given multiple times to select multiple inode numbers. -V Prints the version number and exits. If the filesystem is seriously corrupted, or very busy and looks like it is corrupt, a message of the form that would be generated by xfs_check(8) may appear. xfs_ncheck is only useful with XFS filesystems. SEE ALSO
mkfs.xfs(8), xfs_check(8), xfs(5). xfs_ncheck(8)
All times are GMT -4. The time now is 08:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy