Deleting files using pattern matching for files containing spaces and asterisks
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
Due to a program that wasn't functioning well, I have many files in my home directory starting with a dot and containing strange symbols among which are spaces and asterisks. I want to delete these files, but am having trouble doing so. This problem is similar to Rename file containing spaces and punctuation marks,
but much worse. There are way too many files to remove by hand so I will have to use pattern matching.
Most files start with .txt}
and contain 18Jun22h
(and no files in the directory that I want to keep contain either of these strings). How do I remove all files containing this string given that the files in the directory are certainly not nice unix name? Instead, they contain dots spaces asterisks and brackets and dashes. My initial attempts are failing presumably due to the presence of these symbols in these names.
Any method that deletes them one by one would be completely useless to me due to the quantity of files.
Yes I know it is better to not have files not living up to the unix standard. This is a code I also live by. But a script did not work as it should.
As a second thought, it might be easier to delete all files produced (in the specific directory) between certain times. So alternatively help with this is appreciated.
System: Fedora 27
I had tried ~/*18Jun22h*
but thought that the error saying the argument was too long had to do with the *'s in the filenames expanding and doing something strange. Instead it is just because there are too many files matching this pattern (right?). (I did not know that there is a max on the number of files rm can handle).
files filenames delete
add a comment |Â
up vote
1
down vote
favorite
Due to a program that wasn't functioning well, I have many files in my home directory starting with a dot and containing strange symbols among which are spaces and asterisks. I want to delete these files, but am having trouble doing so. This problem is similar to Rename file containing spaces and punctuation marks,
but much worse. There are way too many files to remove by hand so I will have to use pattern matching.
Most files start with .txt}
and contain 18Jun22h
(and no files in the directory that I want to keep contain either of these strings). How do I remove all files containing this string given that the files in the directory are certainly not nice unix name? Instead, they contain dots spaces asterisks and brackets and dashes. My initial attempts are failing presumably due to the presence of these symbols in these names.
Any method that deletes them one by one would be completely useless to me due to the quantity of files.
Yes I know it is better to not have files not living up to the unix standard. This is a code I also live by. But a script did not work as it should.
As a second thought, it might be easier to delete all files produced (in the specific directory) between certain times. So alternatively help with this is appreciated.
System: Fedora 27
I had tried ~/*18Jun22h*
but thought that the error saying the argument was too long had to do with the *'s in the filenames expanding and doing something strange. Instead it is just because there are too many files matching this pattern (right?). (I did not know that there is a max on the number of files rm can handle).
files filenames delete
It's difficult to suggest anything without knowing what the files are or if they all contain a specific pattern.
â Nasir Riley
Jun 25 at 18:07
Show us what you tried.
â ctrl-alt-delor
Jun 25 at 18:09
Do the file names contain18Jun22h
or is that in the contents of the file?
â Eric Renouf
Jun 25 at 18:14
is this on a GNU/Linux system, or a different OS?
â Jeff Schaller
Jun 25 at 18:40
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
Due to a program that wasn't functioning well, I have many files in my home directory starting with a dot and containing strange symbols among which are spaces and asterisks. I want to delete these files, but am having trouble doing so. This problem is similar to Rename file containing spaces and punctuation marks,
but much worse. There are way too many files to remove by hand so I will have to use pattern matching.
Most files start with .txt}
and contain 18Jun22h
(and no files in the directory that I want to keep contain either of these strings). How do I remove all files containing this string given that the files in the directory are certainly not nice unix name? Instead, they contain dots spaces asterisks and brackets and dashes. My initial attempts are failing presumably due to the presence of these symbols in these names.
Any method that deletes them one by one would be completely useless to me due to the quantity of files.
Yes I know it is better to not have files not living up to the unix standard. This is a code I also live by. But a script did not work as it should.
As a second thought, it might be easier to delete all files produced (in the specific directory) between certain times. So alternatively help with this is appreciated.
System: Fedora 27
I had tried ~/*18Jun22h*
but thought that the error saying the argument was too long had to do with the *'s in the filenames expanding and doing something strange. Instead it is just because there are too many files matching this pattern (right?). (I did not know that there is a max on the number of files rm can handle).
files filenames delete
Due to a program that wasn't functioning well, I have many files in my home directory starting with a dot and containing strange symbols among which are spaces and asterisks. I want to delete these files, but am having trouble doing so. This problem is similar to Rename file containing spaces and punctuation marks,
but much worse. There are way too many files to remove by hand so I will have to use pattern matching.
Most files start with .txt}
and contain 18Jun22h
(and no files in the directory that I want to keep contain either of these strings). How do I remove all files containing this string given that the files in the directory are certainly not nice unix name? Instead, they contain dots spaces asterisks and brackets and dashes. My initial attempts are failing presumably due to the presence of these symbols in these names.
Any method that deletes them one by one would be completely useless to me due to the quantity of files.
Yes I know it is better to not have files not living up to the unix standard. This is a code I also live by. But a script did not work as it should.
As a second thought, it might be easier to delete all files produced (in the specific directory) between certain times. So alternatively help with this is appreciated.
System: Fedora 27
I had tried ~/*18Jun22h*
but thought that the error saying the argument was too long had to do with the *'s in the filenames expanding and doing something strange. Instead it is just because there are too many files matching this pattern (right?). (I did not know that there is a max on the number of files rm can handle).
files filenames delete
edited Jun 26 at 8:45
asked Jun 25 at 18:00
Kvothe
1186
1186
It's difficult to suggest anything without knowing what the files are or if they all contain a specific pattern.
â Nasir Riley
Jun 25 at 18:07
Show us what you tried.
â ctrl-alt-delor
Jun 25 at 18:09
Do the file names contain18Jun22h
or is that in the contents of the file?
â Eric Renouf
Jun 25 at 18:14
is this on a GNU/Linux system, or a different OS?
â Jeff Schaller
Jun 25 at 18:40
add a comment |Â
It's difficult to suggest anything without knowing what the files are or if they all contain a specific pattern.
â Nasir Riley
Jun 25 at 18:07
Show us what you tried.
â ctrl-alt-delor
Jun 25 at 18:09
Do the file names contain18Jun22h
or is that in the contents of the file?
â Eric Renouf
Jun 25 at 18:14
is this on a GNU/Linux system, or a different OS?
â Jeff Schaller
Jun 25 at 18:40
It's difficult to suggest anything without knowing what the files are or if they all contain a specific pattern.
â Nasir Riley
Jun 25 at 18:07
It's difficult to suggest anything without knowing what the files are or if they all contain a specific pattern.
â Nasir Riley
Jun 25 at 18:07
Show us what you tried.
â ctrl-alt-delor
Jun 25 at 18:09
Show us what you tried.
â ctrl-alt-delor
Jun 25 at 18:09
Do the file names contain
18Jun22h
or is that in the contents of the file?â Eric Renouf
Jun 25 at 18:14
Do the file names contain
18Jun22h
or is that in the contents of the file?â Eric Renouf
Jun 25 at 18:14
is this on a GNU/Linux system, or a different OS?
â Jeff Schaller
Jun 25 at 18:40
is this on a GNU/Linux system, or a different OS?
â Jeff Schaller
Jun 25 at 18:40
add a comment |Â
5 Answers
5
active
oldest
votes
up vote
3
down vote
accepted
To find files in the home directory (only) that contains at least one space:
find "$HOME" -maxdepth 1 -type f -name '*[ ]*'
... that contain at least one *
:
find "$HOME" -maxdepth 1 -type f -name '*[*]*'
... that contain at least [
or ]
:
find "$HOME" -maxdepth 1 -type f -name '*[[]]*'
... that contain one of any of the above:
find "$HOME" -maxdepth 1 -type f -name '*[ *[]]*'
To delete these files, add either -delete
to the end of the command, or -exec rm +
.
On systems where find
does not support -maxdepth 1
, running from the home directory:
find . -type d ! -name . -prune -o -type f -name '*[ *[]]*' -print
@JeffSchaller Ah, I missed the bit about the home directory. You're right.
â Kusalananda
Jun 25 at 18:40
-name '*[* ]*'
would probably be more portable. No need for-type d
,-prune
is harmless on non-directories:find . ! -name . -prune -type f -name '*[* ]*'
â Stéphane Chazelas
Jun 26 at 9:00
You may need LC_ALL=C as without it, that may fail to match on file names that contain bytes not forming valid characters in the locale's charset.
â Stéphane Chazelas
Jun 26 at 9:02
add a comment |Â
up vote
1
down vote
Since none of .txt}
is special to the shell (there's no opening curly brace), simply:
rm ~/.txt}* ~/*18Jun22h*
or if there are too many, split it up:
rm ~/.txt}*
rm ~/*18Jun22h*
These didn't work. The first line (second part) says the argument is too long. The second part actually does not seem to find the files at all. It gives: "rm: cannot remove '/home/name/*18Jun22h*': No such file or directory". Even though with ls -a it is clear that the files containing this do exist (should I add an option to delete hidden files (note the files start with a dot).
â Kvothe
Jun 26 at 8:35
Depends on the shell.rm ~/.txt}*
would be a syntax error inzsh
(except insh
emulation),fish
andrc
and derivatives.
â Stéphane Chazelas
Jun 26 at 8:53
add a comment |Â
up vote
0
down vote
You can come in and out of quotations.
E.g. to remove A file starting with *
, then do
rm "*"*
Practice with echo
first echo "*"*
add a comment |Â
up vote
0
down vote
You can get the filenames for files which contain a given expression with grep -l
, for example grep -l '18Jun22h' *
. You can use --null
to pass a null character between the files, and send that to xargs
:
$ grep -l '18Jun22h' * --null | xargs -0 rm --
I would recommend doing a sanity check first though, as with this 'create and then remove the files' demonstration:
$ for file in 'test file' 'file?name' 'file*name'; do echo foo > "$file"; done; ls -1
file*name
file?name
test file
$ grep -l foo * --null | xargs -L1 -0 echo
file*name
file?name
test file
$ grep -l foo * --null | xargs -L1 -0 rm --
add a comment |Â
up vote
0
down vote
Way 1: using ./
rm -f ./'file name'
and rm -f ./'file*name'
Way 2: using inode:
Get the inode from ls
ls -i "file name"
then
find . -inum "numberoofinode" -exec rm ;
Except for the note from the OP: âÂÂAny method that deletes them one by one would be completely useless to me due to the quantity of files.âÂÂ
â Jeff Schaller
Jun 25 at 19:49
add a comment |Â
5 Answers
5
active
oldest
votes
5 Answers
5
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
To find files in the home directory (only) that contains at least one space:
find "$HOME" -maxdepth 1 -type f -name '*[ ]*'
... that contain at least one *
:
find "$HOME" -maxdepth 1 -type f -name '*[*]*'
... that contain at least [
or ]
:
find "$HOME" -maxdepth 1 -type f -name '*[[]]*'
... that contain one of any of the above:
find "$HOME" -maxdepth 1 -type f -name '*[ *[]]*'
To delete these files, add either -delete
to the end of the command, or -exec rm +
.
On systems where find
does not support -maxdepth 1
, running from the home directory:
find . -type d ! -name . -prune -o -type f -name '*[ *[]]*' -print
@JeffSchaller Ah, I missed the bit about the home directory. You're right.
â Kusalananda
Jun 25 at 18:40
-name '*[* ]*'
would probably be more portable. No need for-type d
,-prune
is harmless on non-directories:find . ! -name . -prune -type f -name '*[* ]*'
â Stéphane Chazelas
Jun 26 at 9:00
You may need LC_ALL=C as without it, that may fail to match on file names that contain bytes not forming valid characters in the locale's charset.
â Stéphane Chazelas
Jun 26 at 9:02
add a comment |Â
up vote
3
down vote
accepted
To find files in the home directory (only) that contains at least one space:
find "$HOME" -maxdepth 1 -type f -name '*[ ]*'
... that contain at least one *
:
find "$HOME" -maxdepth 1 -type f -name '*[*]*'
... that contain at least [
or ]
:
find "$HOME" -maxdepth 1 -type f -name '*[[]]*'
... that contain one of any of the above:
find "$HOME" -maxdepth 1 -type f -name '*[ *[]]*'
To delete these files, add either -delete
to the end of the command, or -exec rm +
.
On systems where find
does not support -maxdepth 1
, running from the home directory:
find . -type d ! -name . -prune -o -type f -name '*[ *[]]*' -print
@JeffSchaller Ah, I missed the bit about the home directory. You're right.
â Kusalananda
Jun 25 at 18:40
-name '*[* ]*'
would probably be more portable. No need for-type d
,-prune
is harmless on non-directories:find . ! -name . -prune -type f -name '*[* ]*'
â Stéphane Chazelas
Jun 26 at 9:00
You may need LC_ALL=C as without it, that may fail to match on file names that contain bytes not forming valid characters in the locale's charset.
â Stéphane Chazelas
Jun 26 at 9:02
add a comment |Â
up vote
3
down vote
accepted
up vote
3
down vote
accepted
To find files in the home directory (only) that contains at least one space:
find "$HOME" -maxdepth 1 -type f -name '*[ ]*'
... that contain at least one *
:
find "$HOME" -maxdepth 1 -type f -name '*[*]*'
... that contain at least [
or ]
:
find "$HOME" -maxdepth 1 -type f -name '*[[]]*'
... that contain one of any of the above:
find "$HOME" -maxdepth 1 -type f -name '*[ *[]]*'
To delete these files, add either -delete
to the end of the command, or -exec rm +
.
On systems where find
does not support -maxdepth 1
, running from the home directory:
find . -type d ! -name . -prune -o -type f -name '*[ *[]]*' -print
To find files in the home directory (only) that contains at least one space:
find "$HOME" -maxdepth 1 -type f -name '*[ ]*'
... that contain at least one *
:
find "$HOME" -maxdepth 1 -type f -name '*[*]*'
... that contain at least [
or ]
:
find "$HOME" -maxdepth 1 -type f -name '*[[]]*'
... that contain one of any of the above:
find "$HOME" -maxdepth 1 -type f -name '*[ *[]]*'
To delete these files, add either -delete
to the end of the command, or -exec rm +
.
On systems where find
does not support -maxdepth 1
, running from the home directory:
find . -type d ! -name . -prune -o -type f -name '*[ *[]]*' -print
edited Jun 25 at 18:50
answered Jun 25 at 18:20
Kusalananda
101k13199312
101k13199312
@JeffSchaller Ah, I missed the bit about the home directory. You're right.
â Kusalananda
Jun 25 at 18:40
-name '*[* ]*'
would probably be more portable. No need for-type d
,-prune
is harmless on non-directories:find . ! -name . -prune -type f -name '*[* ]*'
â Stéphane Chazelas
Jun 26 at 9:00
You may need LC_ALL=C as without it, that may fail to match on file names that contain bytes not forming valid characters in the locale's charset.
â Stéphane Chazelas
Jun 26 at 9:02
add a comment |Â
@JeffSchaller Ah, I missed the bit about the home directory. You're right.
â Kusalananda
Jun 25 at 18:40
-name '*[* ]*'
would probably be more portable. No need for-type d
,-prune
is harmless on non-directories:find . ! -name . -prune -type f -name '*[* ]*'
â Stéphane Chazelas
Jun 26 at 9:00
You may need LC_ALL=C as without it, that may fail to match on file names that contain bytes not forming valid characters in the locale's charset.
â Stéphane Chazelas
Jun 26 at 9:02
@JeffSchaller Ah, I missed the bit about the home directory. You're right.
â Kusalananda
Jun 25 at 18:40
@JeffSchaller Ah, I missed the bit about the home directory. You're right.
â Kusalananda
Jun 25 at 18:40
-name '*[* ]*'
would probably be more portable. No need for -type d
, -prune
is harmless on non-directories: find . ! -name . -prune -type f -name '*[* ]*'
â Stéphane Chazelas
Jun 26 at 9:00
-name '*[* ]*'
would probably be more portable. No need for -type d
, -prune
is harmless on non-directories: find . ! -name . -prune -type f -name '*[* ]*'
â Stéphane Chazelas
Jun 26 at 9:00
You may need LC_ALL=C as without it, that may fail to match on file names that contain bytes not forming valid characters in the locale's charset.
â Stéphane Chazelas
Jun 26 at 9:02
You may need LC_ALL=C as without it, that may fail to match on file names that contain bytes not forming valid characters in the locale's charset.
â Stéphane Chazelas
Jun 26 at 9:02
add a comment |Â
up vote
1
down vote
Since none of .txt}
is special to the shell (there's no opening curly brace), simply:
rm ~/.txt}* ~/*18Jun22h*
or if there are too many, split it up:
rm ~/.txt}*
rm ~/*18Jun22h*
These didn't work. The first line (second part) says the argument is too long. The second part actually does not seem to find the files at all. It gives: "rm: cannot remove '/home/name/*18Jun22h*': No such file or directory". Even though with ls -a it is clear that the files containing this do exist (should I add an option to delete hidden files (note the files start with a dot).
â Kvothe
Jun 26 at 8:35
Depends on the shell.rm ~/.txt}*
would be a syntax error inzsh
(except insh
emulation),fish
andrc
and derivatives.
â Stéphane Chazelas
Jun 26 at 8:53
add a comment |Â
up vote
1
down vote
Since none of .txt}
is special to the shell (there's no opening curly brace), simply:
rm ~/.txt}* ~/*18Jun22h*
or if there are too many, split it up:
rm ~/.txt}*
rm ~/*18Jun22h*
These didn't work. The first line (second part) says the argument is too long. The second part actually does not seem to find the files at all. It gives: "rm: cannot remove '/home/name/*18Jun22h*': No such file or directory". Even though with ls -a it is clear that the files containing this do exist (should I add an option to delete hidden files (note the files start with a dot).
â Kvothe
Jun 26 at 8:35
Depends on the shell.rm ~/.txt}*
would be a syntax error inzsh
(except insh
emulation),fish
andrc
and derivatives.
â Stéphane Chazelas
Jun 26 at 8:53
add a comment |Â
up vote
1
down vote
up vote
1
down vote
Since none of .txt}
is special to the shell (there's no opening curly brace), simply:
rm ~/.txt}* ~/*18Jun22h*
or if there are too many, split it up:
rm ~/.txt}*
rm ~/*18Jun22h*
Since none of .txt}
is special to the shell (there's no opening curly brace), simply:
rm ~/.txt}* ~/*18Jun22h*
or if there are too many, split it up:
rm ~/.txt}*
rm ~/*18Jun22h*
answered Jun 25 at 18:39
Jeff Schaller
30.8k846104
30.8k846104
These didn't work. The first line (second part) says the argument is too long. The second part actually does not seem to find the files at all. It gives: "rm: cannot remove '/home/name/*18Jun22h*': No such file or directory". Even though with ls -a it is clear that the files containing this do exist (should I add an option to delete hidden files (note the files start with a dot).
â Kvothe
Jun 26 at 8:35
Depends on the shell.rm ~/.txt}*
would be a syntax error inzsh
(except insh
emulation),fish
andrc
and derivatives.
â Stéphane Chazelas
Jun 26 at 8:53
add a comment |Â
These didn't work. The first line (second part) says the argument is too long. The second part actually does not seem to find the files at all. It gives: "rm: cannot remove '/home/name/*18Jun22h*': No such file or directory". Even though with ls -a it is clear that the files containing this do exist (should I add an option to delete hidden files (note the files start with a dot).
â Kvothe
Jun 26 at 8:35
Depends on the shell.rm ~/.txt}*
would be a syntax error inzsh
(except insh
emulation),fish
andrc
and derivatives.
â Stéphane Chazelas
Jun 26 at 8:53
These didn't work. The first line (second part) says the argument is too long. The second part actually does not seem to find the files at all. It gives: "rm: cannot remove '/home/name/*18Jun22h*': No such file or directory". Even though with ls -a it is clear that the files containing this do exist (should I add an option to delete hidden files (note the files start with a dot).
â Kvothe
Jun 26 at 8:35
These didn't work. The first line (second part) says the argument is too long. The second part actually does not seem to find the files at all. It gives: "rm: cannot remove '/home/name/*18Jun22h*': No such file or directory". Even though with ls -a it is clear that the files containing this do exist (should I add an option to delete hidden files (note the files start with a dot).
â Kvothe
Jun 26 at 8:35
Depends on the shell.
rm ~/.txt}*
would be a syntax error in zsh
(except in sh
emulation), fish
and rc
and derivatives.â Stéphane Chazelas
Jun 26 at 8:53
Depends on the shell.
rm ~/.txt}*
would be a syntax error in zsh
(except in sh
emulation), fish
and rc
and derivatives.â Stéphane Chazelas
Jun 26 at 8:53
add a comment |Â
up vote
0
down vote
You can come in and out of quotations.
E.g. to remove A file starting with *
, then do
rm "*"*
Practice with echo
first echo "*"*
add a comment |Â
up vote
0
down vote
You can come in and out of quotations.
E.g. to remove A file starting with *
, then do
rm "*"*
Practice with echo
first echo "*"*
add a comment |Â
up vote
0
down vote
up vote
0
down vote
You can come in and out of quotations.
E.g. to remove A file starting with *
, then do
rm "*"*
Practice with echo
first echo "*"*
You can come in and out of quotations.
E.g. to remove A file starting with *
, then do
rm "*"*
Practice with echo
first echo "*"*
answered Jun 25 at 18:07
ctrl-alt-delor
8,70331947
8,70331947
add a comment |Â
add a comment |Â
up vote
0
down vote
You can get the filenames for files which contain a given expression with grep -l
, for example grep -l '18Jun22h' *
. You can use --null
to pass a null character between the files, and send that to xargs
:
$ grep -l '18Jun22h' * --null | xargs -0 rm --
I would recommend doing a sanity check first though, as with this 'create and then remove the files' demonstration:
$ for file in 'test file' 'file?name' 'file*name'; do echo foo > "$file"; done; ls -1
file*name
file?name
test file
$ grep -l foo * --null | xargs -L1 -0 echo
file*name
file?name
test file
$ grep -l foo * --null | xargs -L1 -0 rm --
add a comment |Â
up vote
0
down vote
You can get the filenames for files which contain a given expression with grep -l
, for example grep -l '18Jun22h' *
. You can use --null
to pass a null character between the files, and send that to xargs
:
$ grep -l '18Jun22h' * --null | xargs -0 rm --
I would recommend doing a sanity check first though, as with this 'create and then remove the files' demonstration:
$ for file in 'test file' 'file?name' 'file*name'; do echo foo > "$file"; done; ls -1
file*name
file?name
test file
$ grep -l foo * --null | xargs -L1 -0 echo
file*name
file?name
test file
$ grep -l foo * --null | xargs -L1 -0 rm --
add a comment |Â
up vote
0
down vote
up vote
0
down vote
You can get the filenames for files which contain a given expression with grep -l
, for example grep -l '18Jun22h' *
. You can use --null
to pass a null character between the files, and send that to xargs
:
$ grep -l '18Jun22h' * --null | xargs -0 rm --
I would recommend doing a sanity check first though, as with this 'create and then remove the files' demonstration:
$ for file in 'test file' 'file?name' 'file*name'; do echo foo > "$file"; done; ls -1
file*name
file?name
test file
$ grep -l foo * --null | xargs -L1 -0 echo
file*name
file?name
test file
$ grep -l foo * --null | xargs -L1 -0 rm --
You can get the filenames for files which contain a given expression with grep -l
, for example grep -l '18Jun22h' *
. You can use --null
to pass a null character between the files, and send that to xargs
:
$ grep -l '18Jun22h' * --null | xargs -0 rm --
I would recommend doing a sanity check first though, as with this 'create and then remove the files' demonstration:
$ for file in 'test file' 'file?name' 'file*name'; do echo foo > "$file"; done; ls -1
file*name
file?name
test file
$ grep -l foo * --null | xargs -L1 -0 echo
file*name
file?name
test file
$ grep -l foo * --null | xargs -L1 -0 rm --
edited Jun 25 at 18:15
answered Jun 25 at 18:09
DopeGhoti
39.7k54779
39.7k54779
add a comment |Â
add a comment |Â
up vote
0
down vote
Way 1: using ./
rm -f ./'file name'
and rm -f ./'file*name'
Way 2: using inode:
Get the inode from ls
ls -i "file name"
then
find . -inum "numberoofinode" -exec rm ;
Except for the note from the OP: âÂÂAny method that deletes them one by one would be completely useless to me due to the quantity of files.âÂÂ
â Jeff Schaller
Jun 25 at 19:49
add a comment |Â
up vote
0
down vote
Way 1: using ./
rm -f ./'file name'
and rm -f ./'file*name'
Way 2: using inode:
Get the inode from ls
ls -i "file name"
then
find . -inum "numberoofinode" -exec rm ;
Except for the note from the OP: âÂÂAny method that deletes them one by one would be completely useless to me due to the quantity of files.âÂÂ
â Jeff Schaller
Jun 25 at 19:49
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Way 1: using ./
rm -f ./'file name'
and rm -f ./'file*name'
Way 2: using inode:
Get the inode from ls
ls -i "file name"
then
find . -inum "numberoofinode" -exec rm ;
Way 1: using ./
rm -f ./'file name'
and rm -f ./'file*name'
Way 2: using inode:
Get the inode from ls
ls -i "file name"
then
find . -inum "numberoofinode" -exec rm ;
answered Jun 25 at 18:59
SivaPrasath
3,88611737
3,88611737
Except for the note from the OP: âÂÂAny method that deletes them one by one would be completely useless to me due to the quantity of files.âÂÂ
â Jeff Schaller
Jun 25 at 19:49
add a comment |Â
Except for the note from the OP: âÂÂAny method that deletes them one by one would be completely useless to me due to the quantity of files.âÂÂ
â Jeff Schaller
Jun 25 at 19:49
Except for the note from the OP: âÂÂAny method that deletes them one by one would be completely useless to me due to the quantity of files.âÂÂ
â Jeff Schaller
Jun 25 at 19:49
Except for the note from the OP: âÂÂAny method that deletes them one by one would be completely useless to me due to the quantity of files.âÂÂ
â Jeff Schaller
Jun 25 at 19:49
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f451810%2fdeleting-files-using-pattern-matching-for-files-containing-spaces-and-asterisks%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
It's difficult to suggest anything without knowing what the files are or if they all contain a specific pattern.
â Nasir Riley
Jun 25 at 18:07
Show us what you tried.
â ctrl-alt-delor
Jun 25 at 18:09
Do the file names contain
18Jun22h
or is that in the contents of the file?â Eric Renouf
Jun 25 at 18:14
is this on a GNU/Linux system, or a different OS?
â Jeff Schaller
Jun 25 at 18:40