| |
 |
|
|
Linux Forum Index » Linux - Red Hat Forum » rm + stdin...
Page 1 of 1
|
| Author |
Message |
| Steffan... |
Posted: Sat Jul 05, 2008 12:02 pm |
|
|
|
Guest
|
I am trying to use rm within an app to manage removing some files. I
end up with the following errors:
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.DBF': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.dbf': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.zip': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.ZIP': No such file or director
I know that the files are most definitely there with one of those
suffixes but am not sure why this happens. Any suggestions? |
|
|
| Back to top |
|
| Steffan... |
Posted: Sat Jul 05, 2008 5:28 pm |
|
|
|
Guest
|
On Jul 5, 8:31 pm, Nico Kadel-Garcia <nka... at (no spam) gmail.com> wrote:
Quote: Steffan wrote:
I am trying to use rm within an app to manage removing some files. I
end up with the following errors:
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.DBF': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.dbf': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.zip': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.ZIP': No such file or director
I know that the files are most definitely there with one of those
suffixes but am not sure why this happens. Any suggestions?
It's probably not there, after all. Why not put in a debugging statement to
verify that it is present or not? And use 'rm -f' in case the file isn't there
at that moment?
I know the file is there. The path is stored in a variable and reused
all over without fail except when we get to this point. I wonder if
this is more of a limitation of rm being launched via a process rather
than a shell. |
|
|
| Back to top |
|
| Steffan... |
Posted: Sat Jul 05, 2008 9:56 pm |
|
|
|
Guest
|
On Jul 6, 12:13 am, Nico Kadel-Garcia <nka... at (no spam) gmail.com> wrote:
Quote: Steffan wrote:
On Jul 5, 8:31 pm, Nico Kadel-Garcia <nka... at (no spam) gmail.com> wrote:
Steffan wrote:
I am trying to use rm within an app to manage removing some files. I
end up with the following errors:
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.DBF': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.dbf': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.zip': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.ZIP': No such file or director
I know that the files are most definitely there with one of those
suffixes but am not sure why this happens. Any suggestions?
It's probably not there, after all. Why not put in a debugging statement to
verify that it is present or not? And use 'rm -f' in case the file isn't there
at that moment?
I know the file is there. The path is stored in a variable and reused
all over without fail except when we get to this point. I wonder if
this is more of a limitation of rm being launched via a process rather
than a shell.
Thmm. Let's think about this. That is *NOT* a file. It is a regexp that is
supposed to find files in that directory that match that regexp. Just because
you use it elsewhere, doesn't mean there are any such files there: the output
of a command like 'ls', with that argument, will output nothing to stdout if
there are no such files, and simply report exactly that sort of error if to
stderr.
OK, with me so far?
So you need to report whether such files actually exist. An 'ls' with output,
run just before the 'rm' command, might be helpful. And further analysis
depends on exactly what your application is doing.
Well, it appears to be an issue with using rm within a process. I
opened a shell rather than a process and executed the same rm
statement and it worked. So, I guess in this case I may have to just
stick with the shell as it seems faster in my case. |
|
|
| Back to top |
|
| Nico Kadel-Garcia... |
Posted: Sat Jul 05, 2008 10:31 pm |
|
|
|
Guest
|
Steffan wrote:
Quote: I am trying to use rm within an app to manage removing some files. I
end up with the following errors:
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.DBF': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.dbf': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.zip': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.ZIP': No such file or director
I know that the files are most definitely there with one of those
suffixes but am not sure why this happens. Any suggestions?
It's probably not there, after all. Why not put in a debugging statement to
verify that it is present or not? And use 'rm -f' in case the file isn't there
at that moment? |
|
|
| Back to top |
|
| Nico Kadel-Garcia... |
Posted: Sun Jul 06, 2008 2:13 am |
|
|
|
Guest
|
Steffan wrote:
Quote: On Jul 5, 8:31 pm, Nico Kadel-Garcia <nka... at (no spam) gmail.com> wrote:
Steffan wrote:
I am trying to use rm within an app to manage removing some files. I
end up with the following errors:
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.DBF': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.dbf': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.zip': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.ZIP': No such file or director
I know that the files are most definitely there with one of those
suffixes but am not sure why this happens. Any suggestions?
It's probably not there, after all. Why not put in a debugging statement to
verify that it is present or not? And use 'rm -f' in case the file isn't there
at that moment?
I know the file is there. The path is stored in a variable and reused
all over without fail except when we get to this point. I wonder if
this is more of a limitation of rm being launched via a process rather
than a shell.
Thmm. Let's think about this. That is *NOT* a file. It is a regexp that is
supposed to find files in that directory that match that regexp. Just because
you use it elsewhere, doesn't mean there are any such files there: the output
of a command like 'ls', with that argument, will output nothing to stdout if
there are no such files, and simply report exactly that sort of error if to
stderr.
OK, with me so far?
So you need to report whether such files actually exist. An 'ls' with output,
run just before the 'rm' command, might be helpful. And further analysis
depends on exactly what your application is doing. |
|
|
| Back to top |
|
| Rajendra Singh... |
Posted: Sun Jul 06, 2008 2:58 am |
|
|
|
Guest
|
What language are you using? For example in C, you could:
opendir();
readdir();
unlink();
closedir();
On Jul 5, 6:02 pm, Steffan <steffan.cl... at (no spam) gmail.com> wrote:
Quote: I am trying to use rm within an app to manage removing some files. I
end up with the following errors:
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.DBF': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.dbf': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.zip': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.ZIP': No such file or director
I know that the files are most definitely there with one of those
suffixes but am not sure why this happens. Any suggestions? |
|
|
| Back to top |
|
| Jan Gerrit Kootstra... |
Posted: Sun Jul 06, 2008 6:40 am |
|
|
|
Guest
|
Steffan wrote:
Quote: On Jul 6, 12:13 am, Nico Kadel-Garcia <nka... at (no spam) gmail.com> wrote:
Steffan wrote:
On Jul 5, 8:31 pm, Nico Kadel-Garcia <nka... at (no spam) gmail.com> wrote:
Steffan wrote:
I am trying to use rm within an app to manage removing some files. I
end up with the following errors:
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.DBF': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.dbf': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.zip': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.ZIP': No such file or director
I know that the files are most definitely there with one of those
suffixes but am not sure why this happens. Any suggestions?
It's probably not there, after all. Why not put in a debugging statement to
verify that it is present or not? And use 'rm -f' in case the file isn't there
at that moment?
I know the file is there. The path is stored in a variable and reused
all over without fail except when we get to this point. I wonder if
this is more of a limitation of rm being launched via a process rather
than a shell.
Thmm. Let's think about this. That is *NOT* a file. It is a regexp that is
supposed to find files in that directory that match that regexp. Just because
you use it elsewhere, doesn't mean there are any such files there: the output
of a command like 'ls', with that argument, will output nothing to stdout if
there are no such files, and simply report exactly that sort of error if to
stderr.
OK, with me so far?
So you need to report whether such files actually exist. An 'ls' with output,
run just before the 'rm' command, might be helpful. And further analysis
depends on exactly what your application is doing.
Well, it appears to be an issue with using rm within a process. I
opened a shell rather than a process and executed the same rm
statement and it worked. So, I guess in this case I may have to just
stick with the shell as it seems faster in my case.
Stefan,
Do you run the shell and the process under the same user?
Kind regards,
Jan Gerrit Kootstra |
|
|
| Back to top |
|
| HASM... |
Posted: Sun Jul 06, 2008 9:17 am |
|
|
|
Guest
|
Steffan <steffan.cline at (no spam) gmail.com> writes:
Quote: Well, it appears to be an issue with using rm within a process. I
opened a shell rather than a process and executed the same rm
statement and it worked. So, I guess in this case I may have to just
stick with the shell as it seems faster in my case.
Your subprocess is not doing file globbing. Which "app" are you talking
about?
-- HASM |
|
|
| Back to top |
|
| Nico Kadel-Garcia... |
Posted: Sun Jul 06, 2008 9:23 am |
|
|
|
Guest
|
Rajendra Singh wrote:
Quote: What language are you using? For example in C, you could:
opendir();
readdir();
unlink();
closedir();
On Jul 5, 6:02 pm, Steffan <steffan.cl... at (no spam) gmail.com> wrote:
I am trying to use rm within an app to manage removing some files. I
end up with the following errors:
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.DBF': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.dbf': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.zip': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.ZIP': No such file or director
I know that the files are most definitely there with one of those
suffixes but am not sure why this happens. Any suggestions?
What? This won't work with C at all! It's not a directory, it's all files in
the directory that end with the suffix *.DBF or *.dbf.
This is not a RedHat specific issue, this is an issue of whatever language the
software is written in. |
|
|
| Back to top |
|
| Nico Kadel-Garcia... |
Posted: Mon Jul 07, 2008 3:01 am |
|
|
|
Guest
|
Nico Kadel-Garcia wrote:
Quote: Rajendra Singh wrote:
What language are you using? For example in C, you could:
opendir();
readdir();
unlink();
closedir();
On Jul 5, 6:02 pm, Steffan <steffan.cl... at (no spam) gmail.com> wrote:
I am trying to use rm within an app to manage removing some files. I
end up with the following errors:
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.DBF': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.dbf': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.zip': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.ZIP': No such file or director
I know that the files are most definitely there with one of those
suffixes but am not sure why this happens. Any suggestions?
What? This won't work with C at all! It's not a directory, it's all
files in the directory that end with the suffix *.DBF or *.dbf.
This is not a RedHat specific issue, this is an issue of whatever
language the software is written in.
Rajenda sent me a private email, which I'm not sure he sent to the group as
well, so I'm following up here. Rajenda wrote: "Yes it will work with C.
readdir reads the contents of a directory."
I'm reading the original request above. That is for 'all files in the
directory that end in {dbf,DBF,zip,ZIP}'. That's not 'all files in the
directory, so no, it won't work. without cleverness to avoid other files. That
takes some regexp handling, which is where our hero may have been having
trouble in the first place.
I'll revoice my concern that his 'rm' statement is happening at a time when
there are, in fact, no such files in place. It's easy with any kind of
asynchronous operations, such as clearing the debris away from another
program, to accidentally run the 'rm' when the files aren't actually generated
yet. |
|
|
| Back to top |
|
| Johnny Rebel... |
Posted: Mon Jul 07, 2008 6:11 pm |
|
|
|
Guest
|
Steffan wrote:
Quote: I am trying to use rm within an app to manage removing some files. I
end up with the following errors:
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.DBF': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.dbf': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.zip': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.ZIP': No such file or director
I know that the files are most definitely there with one of those
suffixes but am not sure why this happens. Any suggestions?
Looks like your '*' is not expanding so it is looking to delete a
file(s) named specifically *.dbf etc... change or remove the quotes to
get the '*' expanding as you want.
JR.
--
Bill will have to take Linux from my cold, dead flippers.
-Tux. |
|
|
| Back to top |
|
| H.Janssen... |
Posted: Sat Jul 12, 2008 5:31 am |
|
|
|
Guest
|
Dear Steffan,
Steffan wrote:
Quote: I am trying to use rm within an app to manage removing some files. I
end up with the following errors:
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.DBF': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.dbf': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.zip': No such file or directory
/bin/rm: cannot remove `/var/www/html/informationmarket/toImport/
*.ZIP': No such file or director
I know that the files are most definitely there with one of those
suffixes but am not sure why this happens. Any suggestions?
How do you call "rm"? Via a "system()" call or via an
"exec..." call?
The wildcards are expanded by the shell, and that's missing
if you use the exec family of calls. Then "rm" tries to delete
ONE file named "*.DBF", and files with an asterix in the name will be
definitively not there....
-------------------------------------------------
#include <stdio.h>
#include <unistd.h>
main ()
{
execlp("/bin/rm","/bin/rm","*.DBF",NULL);
}
-----------------------------------------------
../test
/bin/rm: cannot remove `*.DBF': No such file or directory
-------------------------------------------------
#include <stdio.h>
#include <unistd.h>
main ()
{
system("rm -f *.DBF");
}
------------------------------------------------
works as intended
Kind Regards,
H.Janssen |
|
|
| Back to top |
|
| |
|
Page 1 of 1
All times are GMT - 5 Hours
The time now is Sun Nov 23, 2008 5:11 am
|
|