How to change added torrent file location for transmission-daemon - raspberry-pi

The transmission-daemon stores by default some temporary files and the added torrent files in the following directory:
/var/lib/transmission-daemon/.config/transmission-daemon/
Is it possible to set another directory?

Why not just ln -s /var/lib/transmission-daemon/.config/transmission-daemon/ ~/MyAwesomeTransmissionConfigDirecotry or whatnot? ;-)
You'll just probably need sudo to ls it :)

Related

What does [rm -rf /] do?

This is basically recursively remove everything from root right?
Would this really delete everything on the device?
Do any operating systems have protections against running this – like a confirmation or something?
Seemed like a better idea to ask than to try.
The rm command means it is applied for removing file-folders based on the file path but as you have specified rm -rf / it tells to remove the files which are part of the root directory in the Linux or Unix based system, but again it will not do anything until and unless you apply the command with sudo access or super user do access with your system password.
Yes this would delete recursively.
Actually their is also a protection:
rm: it is dangerous to operate recursively on '/'
rm: use --no-preserve-root to override this failsafe
rm -rf is a dangerouse command in linux.if rm -rf run with root privilage it force to delete all files and folders even hidden file and you must install os again. this command has not confirmation question.
As a security measure, you can set rm to always get you approved for the delete operation, it uses the "-i" option whenever you want to delete a file or directory. To make this command permanent, add the following alias to the $ HOME / .bashrc file.
When you run the rm command, it will run with the "-i" option by default. (If you use the "-f" option, these settings will be overwrite)
rm -rf
this code deletes all files on linux (system ,root files include)
this is very dangerous code

Copying from Windows to Linux without copying the entire path

I am using Cygwin to copy all the files in a local windows folder to an EC2 linux instance inside of powershell. When I attempt to copy all the files in a folder, it copies the pathname as a folder:
\cygwin64\bin\scp.exe -i "C:\cygwin64\home\Ken\ken-key-pair.pem" -vr \git\configs\configs_test\ ec2-user#ec2-22-75-189-18.compute-1.amazonaws.com:/var/www/html/temp4configs/
will copy the correct files, but incorrectly include the path in a Windows format a path like:
/var/www/html/temp4configs/\git\configs\configs_test/file.php
I have tried an asterisk after the folder without the -r, such as:
\cygwin64\bin\scp.exe -i "C:\cygwin64\home\Ken\ken-key-pair.pem" -v \git\configs\configs_test\* ec2-user#ec2-22-75-189-18.compute-1.amazonaws.com:/var/www/html/temp4configs/
but that will return an error such as
"gitconfigsconfigs_test*: No such file or directory"
What can I do to copy the files without copying the path?
Thanks
When using cygwin programs is safer to use POSIX Path, and most of the time is the only way. To covert from windows to posix PATH use cygpath
$ cygpath -u "C:\cygwin64\home\Ken\ken-key-pair.pem"
/home/Ken/ken-key-pair.pem
$ cygpath -u "C:\git\configs\configs_test\ "
/cygdrive/c/git/configs/configs_test/
Using the windows one, will cause the server to misunderstand the client request

How to make correct wget request?

I need to copy xml file from server to my folder and name it as daily.xml. Here is my code.
The problem is that every new file has name daily.xml.1, daily.xml.2 etc
How to name new file as daily.xml, and previous file as previous-daily.xml? As I know I need to use -O but I don't understand how to use it
wget -P /home/name/name2/docs/xml/ http://www.domain.com/XML/daily.xml
How to make correct request?
What about
wget -P /home/name/name2/docs/xml/ http://www.domain.com/XML/daily.xml -O daily$(date +'%Y%m%d%H%M%S').xml
Maybe the resolution by seconds is not fine enough and you need to have a count variable.
This dose not, however, rename your previous files.
In case your only original problem was the your system does not recognize *.xml.7 as xml-file, the command above should fix this.
Edit: as for your comment, you could do
mv daily.xml previous-daily.xml;wget -P /home/name/name2/docs/xml/ http://www.domain.com/XML/daily.xml -O daily.xml

How to download a specific directory w/o the creation of the directory path from the root of the site to the specified directory

wget -r -np www.a.com/b/c/d
The above will create a directory called 'www.a.com' in the current working directory on my local computer, containing all subdirectories on the path to 'd'.
I only want directory 'd' (and its contents) created in my cwd.
How can I achieve this?
You can mention that directory name explicitely and avoid creation of sub-directories by the following line.
wget -nd -P /home/d www.a.com/b/c/d
The -nd will avoid creation of sub-directories and -P will set the directory to /home/d and all your files will be downloaded to "/home/d" folder only.

How to specify the download location with wget?

I need files to be downloaded to /tmp/cron_test/. My wget code is
wget --random-wait -r -p -nd -e robots=off -A".pdf" -U mozilla http://math.stanford.edu/undergrad/
So is there some parameter to specify the directory?
From the manual page:
-P prefix
--directory-prefix=prefix
Set directory prefix to prefix. The directory prefix is the
directory where all other files and sub-directories will be
saved to, i.e. the top of the retrieval tree. The default
is . (the current directory).
So you need to add -P /tmp/cron_test/ (short form) or --directory-prefix=/tmp/cron_test/ (long form) to your command. Also note that if the directory does not exist it will get created.
-O is the option to specify the path of the file you want to download to:
wget <uri> -O /path/to/file.ext
-P is prefix where it will download the file in the directory:
wget <uri> -P /path/to/folder
Make sure you have the URL correct for whatever you are downloading. First of all, URLs with characters like ? and such cannot be parsed and resolved. This will confuse the cmd line and accept any characters that aren't resolved into the source URL name as the file name you are downloading into.
For example:
wget "sourceforge.net/projects/ebosse/files/latest/download?source=typ_redirect"
will download into a file named, ?source=typ_redirect.
As you can see, knowing a thing or two about URLs helps to understand wget.
I am booting from a hirens disk and only had Linux 2.6.1 as a resource (import os is unavailable). The correct syntax that solved my problem downloading an ISO onto the physical hard drive was:
wget "(source url)" -O (directory where HD was mounted)/isofile.iso"
One could figure the correct URL by finding at what point wget downloads into a file named index.html (the default file), and has the correct size/other attributes of the file you need shown by the following command:
wget "(source url)"
Once that URL and source file is correct and it is downloading into index.html, you can stop the download (ctrl + z) and change the output file by using:
-O "<specified download directory>/filename.extension"
after the source url.
In my case this results in downloading an ISO and storing it as a binary file under isofile.iso, which hopefully mounts.
"-P" is the right option, please read on for more related information:
wget -nd -np -P /dest/dir --recursive http://url/dir1/dir2
Relevant snippets from man pages for convenience:
-P prefix
--directory-prefix=prefix
Set directory prefix to prefix. The directory prefix is the directory where all other files and subdirectories will be saved to, i.e. the top of the retrieval tree. The default is . (the current directory).
-nd
--no-directories
Do not create a hierarchy of directories when retrieving recursively. With this option turned on, all files will get saved to the current directory, without clobbering (if a name shows up more than once, the
filenames will get extensions .n).
-np
--no-parent
Do not ever ascend to the parent directory when retrieving recursively. This is a useful option, since it guarantees that only the files below a certain hierarchy will be downloaded.
man wget:
-O file
--output-document=file
wget "url" -O /tmp/cron_test/<file>