Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 12 months ago.
Improve this question
This maybe easy on linux users, but I am having a hard time figuring out how to delete multiple files (partial files) using wildcard.
sudo rm logs/archived/remove_me.2022.* or sudo rm logs/archived/remove_me.2022.? seems not to work.
I am getting the error rm: cannot remove 'logs/archived/remove_me.*': No such file or directory
I am currently on /var/lib/tomcat8/ trying to remove these logs inside logs/archived.
I am remove them one by one but there are a lot of files to remove .. (example. from 2020 and there are daily and in partial files).
Example I am inside /var/lib/tomcat8/logs/archived/ and I want to remove all log files starting with remove_me.2021.*
Below are the sample list of files that I want to remove.There are also other files in this directory that should not be removed.
remove_me.2022-03-02.1.log.gz
remove_me.2022-03-02.2.log.gz
remove_me.2022-03-02.3.log.gz
remove_me.2022-03-02.4.log.gz
remove_me.2022-03-02.5.log.gz
remove_me.2022-03-03.1.log
remove_me.2022-03-03.2.log
remove_me.2022-03-03.3.log
remove_me.2022-03-03.4.log
remove_me.2022-03-03.5.log
remove_me.2022-03-03.6.log
remove_me.2022-03-03.7.log
remove_me.2022-03-03.8.log
remove_me.2022-03-03.9.log
remove_me.2022-03-03.10.log
I believe the issue here is that the asterisk (*) is resolved by the current user, i.e., before becoming the superuser. Hence, it resolves to nothing, because the current user is not able to even read that directory.
Solve this by becoming superuser first, and then doing everything normally:
sudo -i
cd /var/lib/tomcat8/logs/archived/
rm remove_me.2022.*
Related
Closed. This question is not about programming or software development. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed last month.
Improve this question
Ayo,
I'm using an FTP FileZilla solution and recently noticed that a few of my old directories are still on the server. I'm simply unable to erase those old directories because of one single file inside, that whenever I try to delete, says: 550 Forbidden filename
Does anyone know how to fix that?
thanks!
There are a couple of potential workarounds for this, I believe it can be caused by "invisible" characters in the filename.
Firstly, try to rename the file (ideally in shell mv 3.jpg deleteme.jpg).
Secondly, you can try to create a PHP file in the directory which contains that file. Insert the code:
<?php
unlink('3.jpg');
?>
Then load the php file in a browser or execute in shell:
> php myphpfile.php
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
Ok this is embarrassing!! I wanted to move remote folder from downloads on to /var/www/html directory !! So I used the following command with sudo
mv /Downloads/remote /var/www/html/remote
And messed up entire file system !! All my home folders which includes downloads, folders and data on desktop everything is moved in /var/www/html/remote and no application or files seems to open !! The only thing that opens is the terminal !! How can I fix this please help !!
First thing to try to reverse it:
sudo mv /var/www/html/remote/<your_user_name> /home/
Otherwise if <your_user_name> isn't in /var/www/html/remote/, do a:
sudo cp -rp /var/www/html/remote/<your_user_name>/* /home/<your_user_name>/
then remove manually what shouldn't be in directory remote and what shouldn't be in directory /home/<your_user_name>/...
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 6 years ago.
Improve this question
I was editing an emacs file abc, and prior to saving, had a crash. There is now a file .#abc, and I would like to find out what is in that file, to perhaps recover what I was working on.
I know the file is there because when I type
ls -a
it lists
.#abc
However, when I type
more ".#abc"
or simply
more .#abc
I get the error
.#abc: No such file or directory
The same error occurs with cp in place of more.
How do I see what is in that file? Why does ls list it and then other commands can't find the file?
(Is .#abc actually an alias file? If so, how would I know that? And how, nevertheless, do I see the content of it, even if this is only what it is an alias to?)
[Note: I do not want to use emacs to try to find out what is in the file or restore it, because the situation is somewhat more complicated than described: the above is all occurring inside a Time Machine backup, which I need to access because of an emacs autosave overwrite problem on the primary file. I don't want to have the same problem occur on the backup of the autosave file!]
This is all on Mac OS10.8.4.
Whereas autosave files use a tilde ~, lock-files use a dot number-sign .#:
http://www.gnu.org/software/emacs/manual/html_node/elisp/File-Locks.html
Creation of lock-files can be disabled with the following setting:
(setq create-lockfiles nil)
https://stackoverflow.com/a/12974060/2112489
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
hey guys so im using Ubuntu and im having a issue finding the files using the ln command
currently i have a folder called myName.2 within it are 3 folders notes, assignments and web.
within notes i created 3 files called linux.txt, unix.txt and shell.txt, now i have redirected myself so im in the folder web and want to create hard links to these files here, so for example i type the command
ln /home/admin/3000/Assignment1/myName.2/notes/linux.txt
however the terminal is telling me,
ln: accessing `/home/admin/3000/Assignment1/myName.2/notes/linux.txt': No such file or directory
i went to the properties of the linux text file and copy and pasted the path straight from there
any hints would be much appreciated thanks!
It's easy to make typos, and simpler to use relative paths. Try:
ln ../notes/linux.txt
from inside the web directory.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I puts all my dotfiles in $HOME/Dropbox/dotfiles
and make a hard link(I think it's the way to go, and for instance vim does't load soft link rc file)
ln $HOME/Dropbox/dotfiles/.vimrc $HOME/.vimrc
The problem is as long as I make change to the file in the dropbox directories, everything works as expected. But when I change the hard link file(which is $HOME/.vimrc), the original file changes accordingly, but dropbox won't sync!!(same as iCloud mobile document folder)
Any idea?
Use soft links. Hard links make it so that Dropbox can't tell when the file is updated. This is because Dropbox doesn't poll the contents of every single file you have, it just looks at modification dates on the files located in your Dropbox.
This is exactly what I use for syncing my dot files with Dropbox:
$ ln -s ~/Dropbox/dotfiles/.vimrc .vimrc
and vim still loads the soft-linked vimrc file.