New answers tagged

0

the quotes are needed because of the way zip handles multiple arguments: rm: remove all files in the argument list zip: unzip the file in the first argument. only extract the files in the remaining arguments. $ ls *.zip file1.zip file2.zip file3.zip $ unzip *.zip Archive: file1.zip caution: filename not matched: file2.zip caution: filename not ...


2

A command will receive the arguments after they have been processed by the shell. On first processing, an unquoted * will be expanded by the shell (to the list of files in the present directory (pwd) that match the pattern): echo *.zip Will list all .zip files. But echo "*".zip" will not. On first processing, a quoted "*" will not be expanded, it will ...


22

The difference between those two commands is the quoted * character. If you call a command in a shell and use the * character for an argument, the shell itself will evaluate the argument. See this example: $ ls file1.zip file2.zip file3.zip file4.txt Now with a *: $ ls *.zip file1.zip file2.zip file3.zip The shell evaluates the wildcard and builds ...


6

The difference is in the first case the shell itself expands the glob: % cd / % echo * Applications Library Network System Users Volumes bin cores ... % while in the second case the application itself Does Something™ with that literal character: % cd / % perl -E 'chdir "/tmp" or die; say for ...


55

You've explained the situation very well. The final piece to the puzzle is that unzip can handle wildcards itself: http://www.info-zip.org/mans/unzip.html ARGUMENTS file[.zip] ... Wildcard expressions are similar to those supported in commonly used Unix shells (sh, ksh, csh) and may contain: * matches a sequence of 0 or more ...


0

I found out that the .$EXTEND directory is created on an Oracle ZFS storage system when SMB is enabled. SMB can be disabled for the pool but the .$EXTEND directory still cannot be removed.


0

This works perfectly for me, tested several variations worked every time. From the directory that holds the images directory. rm -frd ./images/* before: images/ |_ header.png |_ footer.png |_ subdir/ after: images/


0

The question was to empty a directory = remove contents of a directory including hidden files, but not the directory itself. The find command with -mindepth 1 is actually the correct way to go, but to avoid error messages it must be joined with -maxdepth 1: find /path/to/dir -mindepth 1 -maxdepth 1 -exec rm -rf '{}' \;


2

To differentiate a variable from a string bash uses $. When you do : rm -R .$EXTEND variable $EXTEND is expanded and the result is substituted. Inorder to remove .$EXTEND file you need to tell bash to interpret $ without its special meaning. You can do it two ways : rm -R .\$EXTEND #\ strips the special meaning of $ or rm -R '.$EXTEND' # Use single ...


4

You can either escape the $ sign: rm -r .\$EXTEND or use single quotes: rm -r '.$EXTEND'


2

There does seem something strange about what you're doing. This is on Debian testing x86_64: jlquinn@cerberus:~/tmp$ mkdir dira dirb jlquinn@cerberus:~/tmp$ touch dira/fileA.txt jlquinn@cerberus:~/tmp$ ln dira/fileA.txt dirb/fileAlink.txt jlquinn@cerberus:~/tmp$ rm -rfv dirb/* removed 'dirb/fileAlink.txt' jlquinn@cerberus:~/tmp$ ll dira total 0 ...


1

Try: ( cd ~/.jenkins/jobs/subco find . -path ./myapp -prune -o -type f -name '*.jar' -print0 | ... ) Adding -type f to restrict the condition, since when you want to match JAR files only. And also, you used -print0, it's likely that your find supports -delete, so you can use: ( cd ~/.jenkins/jobs/subco find . -path ./myapp -prune -o -type f -name ...


2

Use the -prune option to skip that directory find ~/.jenkins/jobs/subco -path ~/.jenkins/jobs/subco/myapp -prune -o -name '*.jar' -exec rm -r {} +


97

The kernel interprets the line starting with #! and uses it to run the script, passing in the script's name; so this ends up running /bin/rm scriptname which deletes the script. (As Stéphane Chazelas points out, scriptname here is sufficient to find the script — if you specified a relative or absolute path, that's passed in as-is, otherwise whatever path ...


0

You can use -f as it will, according to the man page: Attempt to remove the files without prompting for confirmation, regardless of the file's permissions. If the file does not exist, do not display a diagnostic message or modify the exit status to reflect an error. also remember The -f option overrides any previous -i options. rm -f ...


3

As an alternative, you can use the find command with the -delete option. This will (obviously) only delete the files it finds so it never warns if none are. An example might be: find /var/log/triffids/ -name "*.log" -mtime 30 -delete which would search the /var/log/triffids/ directory and delete all files with the .log suffix which have not been modified ...



Top 50 recent answers are included