Skip to main content
22 events
when toggle format what by license comment
Aug 9, 2018 at 21:25 comment added Stan Brown Forgot to include that. When I changed it to use bash, instead of sh, it just displays -- mv .log four (4) times. Unsure why the file is not being passed to $1.
Aug 9, 2018 at 21:21 comment added RalfFriedl It is ${1%.txt}.log. Maybe your sh is not bash. Try bash instead of sh.
Aug 9, 2018 at 21:17 comment added Stan Brown I got the same error /tmp/block_semaphore.log: ${1.log}.txt: bad substitution.
Aug 9, 2018 at 21:08 comment added Stan Brown It was just a dummy file extension I was using for testing.
Aug 9, 2018 at 21:07 comment added RalfFriedl I don't know where your .stan comes from. I added an example for /tmp with the output, it works for me. Copy the line as it is and see what happens.
Aug 9, 2018 at 21:05 history edited RalfFriedl CC BY-SA 4.0
Add example
Aug 9, 2018 at 20:57 comment added Stan Brown It appears the $1 is not passing the value to ${1%.log}.stan. When I replace the mv to echo it displays .stan.
Aug 9, 2018 at 20:39 comment added Stan Brown Here is the output +mv '' .stan then the error message appears.
Aug 9, 2018 at 20:34 comment added RalfFriedl Try is with ... -exec sh -xc 'echo mv "$1" "${1%.txt}.log"' arg0ignored {} \; for debugging.
Aug 9, 2018 at 20:16 comment added Stan Brown I can get it to run at the command prompt with -mtime now. I am trying to rename the files based off the minutes modified, but the following error appears. mv: cannot stat ``: No such file or directory. It appears four (4) times. I have four .log files in the directory. I changed -mtime +5 to -mmin +5.
Aug 9, 2018 at 19:57 comment added RalfFriedl There is a space before ` -exec`. Write the whole command on one line, I just added the line break for readability.
Aug 9, 2018 at 19:34 comment added Stan Brown I changed the file extensions to test with dummy files.
Aug 9, 2018 at 19:32 comment added Stan Brown ++ printf '\033]0;%s@%s:%s\007' rhadmin gamora '~' [rhadmin@gamora ~]$ bash -x newRenameDataFilesToTxt.sh + bash -x newRenameDataFilesToTxt.sh + find /u/easy/ep2/data/download -maxdepth 1 -name '*.log' -mtime +1 ' -exec' sh -c 'mv "$1" "${1%.log}.stan"' '{};' find: paths must precede expression: -exec Usage: find [-H] [-L] [-P] [-Olevel] [-D help|tree|search|stat|rates|opt|exec] [path...] [expression] ++ printf '\033]0;%s@%s:%s\007' rhadmin gamora '~' [rhadmin@gamora ~]$
Aug 9, 2018 at 19:25 comment added RalfFriedl Can you run it in a script with set -x or invoked with bash -x and show the output?
Aug 9, 2018 at 19:23 comment added Stan Brown Still returns the same error message when I added the arg0ignored.
Aug 9, 2018 at 19:18 comment added Stan Brown I will give that a try! Thank you for your help!
Aug 9, 2018 at 19:17 comment added RalfFriedl I have GNU find 4.6.0, for me this works. I forgot the arg0, that is ignored, but that shouldn't lead to this message.
Aug 9, 2018 at 19:13 history edited RalfFriedl CC BY-SA 4.0
Fixed arguments
Aug 9, 2018 at 19:08 comment added Stan Brown This is the error message I get when I run the script from the command line or inside the script. find: paths must precede expression: -exec
Aug 9, 2018 at 19:00 comment added Stan Brown Sorry, I should have included the Linux version. We are running RedHat Enterprise v 7.4.
Aug 9, 2018 at 18:50 review Low quality posts
Aug 9, 2018 at 19:15
Aug 9, 2018 at 18:33 history answered RalfFriedl CC BY-SA 4.0