Skip to main content

New answers tagged

-1 votes

Find command slow when I'm not piping into awk

Both scripts indeed invoke find 4 times, but the issue of slowness in the second script isn't due to redundancy in the number of find invocations alone. The difference in performance between the two ...
Max Haase's user avatar
  • 105
2 votes

Find command slow when I'm not piping into awk

Pipelining with awk allows the commands to process results in a stream, reducing the overhead associated with storing and then writing the full paths. Direct writes to the file without awk mean the ...
delirehberi's user avatar
1 vote
Accepted

Script to find multiple files and update their timestamps by a second

There are few points to consider: You do not need function for start, you need variable. Do not forget you later do math with this. So your lines: start() { date -d "${start_date}" +%s } ...
Romeo Ninov's user avatar
  • 17.9k
-1 votes

"find" output relative to directory

In case some needs it, only the file name: -exec basename {} \;
William Desportes's user avatar
-1 votes

Error in deleting files or directories older than 1 day

Just specify path followed by type. In your case it's type file(s) and director(ies)y. Separate type with , . Following should work for you. find /u01/Release/ -type f,d -mtime +1 -delete
Merlincool's user avatar
0 votes

find with du -sch and very many files

I would solve it in TXR Lisp like this. Say that the directories we want to find are characterized by having subdirectories called alpha, beta and gamma: (let* ((dirs (glob* "**/{alpha,beta,gamma}...
Kaz's user avatar
  • 8,585
8 votes

Find actual file by only file name, not literally everything non-related

Don't use -L, as the documentation (see man find) writes, if the -L option or the -follow option is in use, a diagnostic message is issued when find encounters a loop of symbolic links. So ...
Chris Davies's user avatar
5 votes
Accepted

find with du -sch and very many files

Your quoting makes no sense, the output of find doesn't get interpreted by a shell; neither does using \n as separator; you should instead always use \0 zero byte as separator and use xargs with -0; ...
Marcus Müller's user avatar
1 vote

find all zip files and hash the contents of the zip

If md5sum clobbers every previous value, you have to stat each file individually.It will require a small shell script. #!/bin/bash # yad gui selects a directory input=$(yad --title "Select ...
JayCravens's user avatar
2 votes

removing hidden control characters in filenames

With zsh: autoload -Uz zmv zmv -n '(**/)(*[^[:print:]]*)(#qD)' '$1${2//[^[:print:]]}' Technically, we could just do: zmv -n '(**/)(*)(#qD)' '$1${2//[^[:print:]]}' But having the glob be more ...
Stéphane Chazelas's user avatar
1 vote
Accepted

Output to multiple files when redirecting output during each find -execdir loop

Redirections is done by the shell prior to running the command (here find). You'd need find to spawn a shell to perform a redirection for each file, or use mediainfo's --LogFile to let it write it ...
Stéphane Chazelas's user avatar
0 votes

Preserve directory structure when moving files using find

You can try with cp --parents, changing to that directory first, and adding --delete to the end in order to mimic move: cd "$soure" find "$soure" -type f -mtime "-$days"...
yucer's user avatar
  • 202
12 votes
Accepted

find -printf for file creation time is not working as expected, is it a bug?

This is a known bug: Linux exposes the creation time via the new statx system call whereas GNU find uses the traditional stat/lstat. Other GNU utilities have made the switch but not find.
muru's user avatar
  • 74k

Top 50 recent answers are included