Tag Info

New answers tagged

0

rm -f find /path/to/files -type file -mtime -5 This will delete the files that are modified within 5 days rm -f find /path/to/files -type file -mtime +5 This will delete the files that are modifed prior 5 days Use ` before find and at the end after 5.


0

For this purpouse I enter in the folder where the files and folders I'm looking for are located and I use: grep -rinHo "my string" Doing so I obtain the file name, the line number and the string


1

find /home/ -ipath "*/temp/some.file" -type f -execdir cp {} another.file \; You just have to change exec to execdir from the other answer (sorry I cannot post it as a comment yet). The execdir option states, according to find's man page: -execdir command {} + Like -exec, but the specified command is run from the subdirectory containing ...


0

find /home/ -ipath "*/temp/some.file" -type f -exec cp {} another.file \;


3

file1 -> dir1/sub file2 -> dir2/sub file3 -> dir3/sub file4 -> dir4/sub . . The names of files and directories are with numbers as above? for i in {1..300}; do cp file$i dir$i/sub; done


0

A workaround is to switch on Auto filter (Project -> Filter -> Auto filter). If you switch it on Task name, you can set a custom filter with containing text, like in Excel.


1

With bash extended globbing patterns: $ shopt -s extglob $ echo outline/!(*-*) outline/crescent.png outline/oval.png outline/trigon.png


0

It works piping grep -v, $ find / -name "*~"|grep -v "/media" looks everywhere but not inside media directory


0

You may also consider using Cygwin which brings you Unix shell and lots of packages to Windows.


0

or if you're using a modern version of windows that comes with powershell, you can do: get-childitem *.txt -recurse|Foreach-Object -Process { Resolve-Path -Relative $_.FullName} which will get you something like .\subdir\test.txt .\subdir2\test1.txt etc


0

The good old "dir" command can achieve that. Try dir *.txt /s . dir works with wildcard characters where * - substitution for 0 or more character(s) ? - for exactly 1 character /s - to travel recursively into subfolders


-1

Easiest way that worked for me: cp --parents -R jobs/**/*.xml ./backup/ one catch is you have to navigate to the "desired" directory before so the "parent path" is correct. Also make sure that you enabled recursive globs in bash: shopt -s globstar


1

The command you are looking for is xargs, as tail doesn't have a native ability to execute a program. The full command would be: ls -tr | tail -n 3 | xargs -I{} mv {} /home/user/Desktop Breaking it down: ls -tr lists files by modification date. tail -n 3 filters it down to the last three entries. xargs -i{} mv {} /home/user/Desktop runs mv {} ...


0

After some searching the web I came up with this: find -L . -type l ! -name 'last*' -exec rm {} \; The brilliant part of this command is the -L switch which tells find to follows symbolic links resulting in only the broken ones remain. The ! -name 'last*' secures my files that should be left alone.


0

The right way to do it is the following: find . -maxdepth 1 -type f -name '*.ai' -print0 | while read -d '' -r file; do python ai2svg.py "$file"; done Notice -print0 option of find which together with -d '' in read takes care of any whitespace characters in the filenames, including newlines and tabs.


1

This will do it: find . -type f -name \*.ai -exec python ai2svg.py {} \; If ai2svg.py works with multiple files (like most *nix tools), you can do this to run the command the minimum amount of times: find . -type f -name \*.ai -exec python ai2svg.py {} + If you only care about files in the current directory you can use the standard loop for this: for ...


1

GNU find has a -ls directive you can use. It has an output format quite close to but not exactly matching that of ls -l. The default action of find, if none is given, is -print which simply prints the file name and path as found. If you add (or replace -print with) -ls then you get a more verbose listing. If you want some particular format for whatever ...


1

You can specify the -ls option to find. Or, if you need a specific format, use -exec: find "$directory" -type f -name '*.vm' -exec ls -l {} \;



Top 50 recent answers are included