Tagged Questions
17
votes
1answer
321 views
How to move a directory, file by file? (instead of “copy then remove”)
My computer has one 500GB drive.
I want to move 400GB of data from /unencrypted to /encrypted.
Both directories are on the same partition, but /encrypted is handled by ecryptfs, so mv /uncrypted/* ...
3
votes
3answers
92 views
How to move all files with a certain file extension from subdirectories to a single directory
I have a directory that contains many subdirectories. The subdirectories contain lots of types of files with different file extensions. I want to move (not copy) all the files of one type into a new ...
2
votes
1answer
38 views
Unable to preserve ownership in a copy but able with a move?
I have noticed that I am unable to preserve ownership if I rsync -o files. However, I am when I move them. This is all without admin privileges. What is the rationale of this? Several threads e.g. ...
2
votes
2answers
75 views
Delete whitespace in filenames in directory
I have a directory where some filenames have been wrongly named something .pdf rather than something.pdf. Is there a quick one liner I can use to delete the whitespace in the filenames.
I have tried ...
1
vote
2answers
42 views
How to strip directory structure with command line (or script)
I have a large collection of files packed into a two-level directory structure with many, many, many folders.
In other words, I have a folder with a great many subfolders in it. There are no ...
2
votes
3answers
115 views
What has happened to the file when I entered “mv file.txt ../”?
I wanted to move 'file.txt' one folder up, but instead of mv file.txt ../file.txt I entered mv file.txt ../.
Now the file is gone and I didn't get any error message. So it seems the some action was ...
1
vote
1answer
29 views
Can one move a relpath in one command?
This question is similar to one I asked recently, but the answers to that question, for the most part, do not extend to this one, AFAICT. The main difference between the two questions is that the ...
2
votes
1answer
248 views
Create sub-directories and organize files by date
I have some directories of files copied from my security camera that I would like to organize into sub-directories by file date. So for example;
-rwxrwxrwx 0 root root 4935241 Jul 19 2012 ...
6
votes
1answer
109 views
Rename current file in vim
Searching over net shows :f filename would rename the current file in vim. But executing this and later exiting vim, shows the new file with all the contents and also the old file is present with the ...
0
votes
2answers
71 views
Including a date in a filename
Inside a directory, there are 150 files named like ABLIMITS.TXT. How do I rename them to ABLIMITS_date.txt prompting the user for date?
1
vote
3answers
89 views
How to move all files plus hidden to folder down?
I want to move all my drupal files in www folder to html folder. I don't know how to do this in terminal and I'm not sure if all folder and files including hidden ones are drupal in the www folder, is ...
1
vote
1answer
245 views
How to move files with same name and concatenate
My directory structure is given below. I need to move all the folders from Test3 to Test2 and concatenate the files with same names
[jg@hpc Test2]$ tree
.
|-- Sample_1008
| |-- ...
-1
votes
1answer
171 views
How to add a string of numbers to multiple text files in a directory?
file.txt
file2.txt
file3.txt
I want to add 99999 to the begining of the all the file names without changing anything else in the file name in solaris 10.
8
votes
3answers
379 views
Flattening a nested directory
This is probably very simple, but I can't figure it out. I have a directory structure like this (dir2 is inside dir1):
/dir1
/dir2
|
--- file1
|
--- file2
What is ...
3
votes
1answer
178 views
How to rename all files and add image size to file name
I can`t make this work. I have a lot of images and i want to rename his name and append image size to name using exiv2
eviv2 pr * prints all info about file
# exiv2 pr 9b523e5a002268fe5067a928
File ...
3
votes
1answer
243 views
Can't rename a directory that I own
I have a directory with a big load of sub directories. I own all of them, and the permissions are all 777.
pascal@azazel /box $ ls -al
total 147872
drwxr-xr-x 293 root root 12288 aoĆ» 22 19:44 ...
1
vote
1answer
257 views
rename files maching specific mtime value within directory
I use simple set of shell commands to in order to create mysqldumps daily. The script is called by cron daemon. It looks like:
presentdate="`date +%d-%m-%Y_%H:%M.%S`"
basedir="/var/db_my_backup"
...
5
votes
4answers
993 views
Renaming a bunch of files with date modified timestamp at the end of the filename?
So, say, I have a directory with a bunch of files like g.txt, where g.txt was last modified on, say, June 20, 2012.
How would I batch-rename all of the files (like g.txt) with the last modified date ...
1
vote
1answer
1k views
Move huge number of files into date structured directory order
I have about 1 million files in this directory: /home/username/images/
Each of the files are called something like: 012345678910(Place)_0_20120414185957_28841.jpg with the timestamp part of the ...
4
votes
1answer
243 views
Renaming files from bash in linux
There is a bunch of files of the following format hh-mm-ss.png where hh, mm, ss are hour, minute and second. How can I rename all these files in the directory in a sequential way from 1.png til n.png ...
3
votes
1answer
1k views
mv file without write permission to the source file
I just realised that I can move a file that I do not own and don't have write permissions on. I have write permissions to the directory, so I am guessing that is why I could move it, but in this ...
4
votes
2answers
118 views
Can I move a directory with open files?
Imagine a bunch of processes using a /home/user/logs directory. They have some logs open for a longer time.
1
vote
1answer
564 views
Rename All Files with a Certain Name
I'm trying to find certain files with the name "stringx" and replace the name (but not the extension) with "stringy". So basically for stringx.txt and stingx.cs, I'd want stringy.txt and stringy.cs. ...
4
votes
2answers
1k views
How can I rename a lot of files using a regex?
I want to rename a lot of files on Mac OS X (10.7.2).. I don't have the perl package for the rename command.
My files have names like "T452-102456-0.png" and I want to delete the "-0" part. I know I ...
7
votes
1answer
1k views
Why can't I have a folder and a file with the same name?
I've never had this problem before, but for some reason, I can't rename my folder to packages/.
This is the structure:
root
- packages_old/
- packages
When I try to rename the folder with ...
2
votes
2answers
195 views
Organizing messy folder based on filetype
I have music lying on my desktop and in my downloads and Music folders. Similarly, I have .odt files lying all over my home folder (mainly desktop). Is there a tool (preferably GUI so my parents can ...
2
votes
3answers
448 views
Rename files with random characters from sha1sum. Does it unique?
I'm using this command to rename files with random characters from sha1sum and move all files from subdirectories to current directory:
for fname in `find . -type f`; do mv "$fname" $(echo "$fname" | ...
13
votes
2answers
2k views
How do open files behave on linux systems?
I just renamed a log file to "foo.log.old", and assumed that the application will start writing a new logfile at "foo.log". I was surprised to discover that it tracked the logfile to its new name, and ...