All Questions

Tagged with
Filter by
Sorted by
Tagged with
0
votes
1answer
32 views

to apply counters on directories inside a folder

I've a folder structure like this: drwxr-xr-x 2 root root 4096 Jun 30 21:34 dir_0.0.1_2 drwxr-xr-x 2 root root 4096 Jul 2 23:45 dir_0.0.1_1 -rw-r--r-- 1 root root 24 Jul 3 00:03 a.sh drwxr-xr-x 2 ...
0
votes
1answer
38 views

Move files to specific folders based on name

I have this file/folder scheme: /Aula /Aula01 /Aula02 aula-01.1.mp4 aula-01.2.mp4 aula-01.3.mp4 aula-02.1.mp4 aula-02.2.mp4 aula-02.3.mp4 All the mp4 files are located in the root directory (...
0
votes
3answers
65 views

Move or rename subfolders

I have a folder structure like this: /ms/files/a/ /fb/files/a/ /db/files/a/ It should be like this: /ms/files/b/ /fb/files/b/ /db/files/b/ I can find the folders I need to move or rename using ...
0
votes
0answers
27 views

How to rename ISPConfig directories set by chattr command

I would to import a restore of a web directories to /var/www/clients/client4/web18/web managed by ISPConfig. I read ISPConfig put an attributes on this kind of directories. /var/www/clients/...
8
votes
3answers
660 views

Flattening directory hierarchy preserving directory names in new directory name

I basically want to go from this: . ├── Alan Walker │   ├── Different World │   │ ├── 01 Intro.mp3 │   │ ├── 02 Lost Control.mp3 │   │ └── cover.jpg │   └── Same World │   ├── 01 Intro.mp3 │...
0
votes
3answers
889 views

How to rename multiple directories?

Here are my directories: P [001] P [002] P [003] I want to rename to: P001 P002 P003 I used the code: for P in *\ *; do mv '$P' '${P// /_}'; done but I am missing something.
1
vote
2answers
418 views

How to find/replace characters in a folder name?

I want to perform the following operations: Find/replace (using regexp) all occurrences of <>:"\|? and replace it with an empty string Find/replace (using regexp) all occurrences of ^\.+|\.+$ ...
0
votes
2answers
28 views

Renaming directories with specific extensions

An extension to the previous question that I asked: Rename an alphanumeric file I have a directory that has subdirectories with an extension of *_upstream: DHX30_vs_Control18....
2
votes
1answer
59 views

Reorder path elements of a directory tree

I have a directory tree where the path elements correspond to specific properties of the file at a particular path. For example, something like this: $ tree . ─ a ─ 1 ─ y ─ 334f │   │   └── z ─ 6410 ...
0
votes
1answer
30 views

Removing part of a bunch of directory names using a wildcard

I am trying use unix to remove the last part of the names of a series of directories. Here is an example of the naming structure: s23987_11.09.16_hf_0001 s29485_03.04.07_hs_0005 s39854_01.01....
0
votes
3answers
140 views

Add a folder in a sequence of folders and rename the other folders

I have x number of folders folder1 folder2 folder3 ...... folder100 What I want to do is; add folder2 reorder So now: folder1 folder2 folder3 ...... folder101 So now, the folder that was folder2 ...
1
vote
2answers
114 views

MV Sub-Directories up one level but not to root

I have several folders in the following structure that I would like to sort. For example: /root/sub1/aaaa/bbbb/cccc/dddd /root/sub2/aaaa/bbbb/cccc/dddd /root/sub3/aaaa/bbbb/cccc/dddd /root/sub4/aaaa/...
1
vote
3answers
2k views

Shell Script to rename current working directory with given name

If present directory is DIR/ and new name project1/ is passed through argument, the present directory name should be replaced by project1.
1
vote
1answer
198 views

Truncating folder names after first space

i have a directory full of sub-directories with names like 01 - title of folder 02 - second title 03 - etc 04 - etc . . . 30 - final folder i want to truncate all of these folder names to just be ...
0
votes
1answer
42 views

Move folder to another folder based on their match

I have a text file as such: Order,Site_ID besnard.sim@gmail.com-10132016-093523-554,AR-Slu The column 'Order' contain the name of the folder that I want to move to the corresponding folder (...
0
votes
1answer
373 views

How to mass rename folder Debian?

I have like FOLDERs name like: /AAA1\BBB1\CCC1 /AAA2\BBB2\CCC2 /AAA3\BBB3\CCC3 How I can mass rename it to: /AAA1_BBB1_CCC1 /AAA2_BBB2_CCC2 /AAA3_BBB3_CCC3
1
vote
2answers
45 views

How to drop final portion of multiple directory names?

I have a number of directories with titles such as "20150512_101129_3016" and others with additional string following an additional underscore, such as "20150512_101129_3016_v1A" (it's not always v1A, ...
1
vote
1answer
254 views

Rename certain files with part of parent directory name

I would like to identify files that meet certain string criteria in subdirectories, then rename those files with the final portion of the directory name, 2 directories up ("pd1"?), then I would like ...
1
vote
1answer
57 views

Rename all the folders by removing specific part of first digits or characters from it is name

I have a long list of folders as follows: 001_bat_3513 002_mon_3213 003_bat_3515 scd_btt_3540 s52_bat_4513 xx2_bpt_8523 056_bot_3513 058_bat_1513 . . From this list: How can I rename all the ...
2
votes
1answer
71 views

How to change name of “~” directory? Debian 8 [duplicate]

I was providing an install directory for SteamCMD to install a server to, but it created a "~" directory as the parent directory for the directory I wanted. Example: /home/steam/SteamCMD/~/...
2
votes
1answer
677 views

Using rename command to rename first part of a file

I have three files in a directory (in mac-osx terminal) say INIT_Struc1 INIT_Struc2 INIT_Struc3 which I need to rename as FINAL_Struc1 FINAL_Struc2 FINAL_Struc3 When I use the rename command (...
-2
votes
1answer
259 views

Find part of filename

Please help with my task: I have a folder with three sub-folders containing six files each. There are two files in each sub-folder with :nopm in their file names. I need to create a shell script ...
6
votes
3answers
4k views

How to remove space in all sub directories in shell script?

I tried following shell script to remove all spaces with underscores: find $1 -depth -name "* *" -print0 | \ while read -d $'\0' f; do mv -v "$f" "${f// /_}"; done If I have a directory /home/user/g ...
5
votes
1answer
6k views

Create directory using filenames and move the files to its repective folder

I have a folder with around 150 text files. I would like to create folders in the name of the 150 files. After that I would like the text file to be moved to its respective folder. Example names of ...
142
votes
11answers
177k views

Merging folders with mv?

If I use mv to move a folder called "folder" to a directory that already contains "folder" will they merge or will it be replaced?
1
vote
2answers
643 views

moving files of certain formats from subdirectoris to directories with same folder names

I’ve got a weird situation. I have 100s of folders with flac and mp3 copies of the same tracks. I need to separate the mp3s from the flacs and put them into similarly named directories. for example: ...
3
votes
2answers
6k views

Automatically moving files to a directory, one by one, and only when the target folder is empty

Is it possible? And in reverse alphabetical order? Essentially, this: How can I move files by type recursively from a directory and its sub-directories to another directory? Except that each file is ...
1
vote
3answers
147 views

Rename directory from within directory?

How would I rename a directory from within that directory? For example: ~/tmp $ rn tmp2 ~/tmp2 $ I can do that with: cd .. && mv tmp tmp2 && cd tmp2, but not sure how to make it ...
1
vote
2answers
172 views

Copying Files in a Folder To Individual Folders

This might sound like something quite odd but for my HTPC, I need to rearrange how my files are stored such that each of the individual files in a folder needs to be moved to a subdirectory of its own ...
1
vote
2answers
649 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
506 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 ...
3
votes
5answers
381 views

move a directory with a single character (back quote) as its name [duplicate]

How can I move a directory whose name is just a space? ls -lah drwx------ 4 user1 user1 8.0K Mar 13 14:16 . drwxr-xr-x 3 root root 60 Mar 13 13:48 .. drwx------ 18 user1 user1 4.0K Mar 13 11:18 ...
1
vote
1answer
68 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 ...
1
vote
1answer
2k views

Help renaming folder according to date

I have the folder "Backup yzT Jan-01-2013". I've made also a script for do a backup everyday. The problem I'm facing is how to rename the folder day by day according to date? Get the new name is ...
1
vote
1answer
281 views

Rename directory based on date of file in directory

I am looking for a smart way to bulk rename directories in my photo library based on the date the pictures were taken. My specific use case: Export the image library from iPhoto or Aperture on OS X ...
67
votes
6answers
35k 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 ...
1
vote
3answers
306 views

Restructuring directories into a hierarchy

I have the following type of folder structure containing thousands of folders. The folder names are as such with different names etc .test .test.subfolder .test.subfolder.subsubfolder .folder ....
3
votes
1answer
4k views

How do I get this find and rename command to work with subdirectories? [duplicate]

Possible Duplicate: Recursive rename files and directories I have a large directory of music files that is often changing as files and directories come and go. My preference is to make sure that ...
6
votes
1answer
5k 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 ....
57
votes
3answers
68k views

Why unix mv program doesn't need -R (recursive) option for directories but cp does need it?

I always get messed up when need to use cp or mv: "do I need -R option when working with dir?" In GNU coreutils cp does need -R and mv doesn't. I just can not find any reason why cp needs -R option ...
4
votes
1answer
490 views

xterm doesn't switch directory when it is moved

Recently I was very frustrated with xterm not behaving as expected. This is what I was doing: open xterm run the following commands: $ mkdir test_01 $ cd test_01/ $ echo 'a' > a $ cat a The ...
6
votes
3answers
10k views

Rename multiple directories

I want to find all directories with the last subdirectory named doc, for then rename them to Doc. How can be renamed? I've the first part: find -type d -name 'doc' which returns directories paths ...
2
votes
2answers
19k views

How can I rename all files in the current directory having a particular extension to another extension? [duplicate]

Possible Duplicate: Renaming multiple files (changing extension) Suppose that in my current/working directory I have five files: file1.xvg file2.xvg file3.xvg file1.eps file2.eps Is there any ...
9
votes
4answers
11k views

Recursively rename subdirectories that match a regex

I have a media server with a folder called Series. (/media/Expansion2/Series/) In it, I have (surprise!) TV series. These are just the show names, e.g., /media/Expansion2/Series/The Big Bang Theory/ ...
6
votes
1answer
8k 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 ...
21
votes
2answers
18k 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 ...
5
votes
2answers
213 views

How does bash continue to work correctly when you move its working directory?

On Linux, I moved a directory to another directory using mv, and in another shell, my working directory happened to be the directory that was moved. I ran hg pull in that shell, and to my surprise, ...
8
votes
3answers
803 views

“mkdir foo; svn mv * foo”

I often want to do some variant of this idiom: $ mkdir 2010 $ svn mv * 2010 Of course, I get an error because the glob matches 2010 as well: svn: Cannot copy path '2010' into its own child '2010/...
12
votes
4answers
3k views

Lowercasing all directories under a directory

I want to lowercase every directories' name under a directory. With which commands can I do that?
30
votes
3answers
35k views

How can I move files by type recursively from a directory and its sub-directories to another directory?

What would be a good way to move a file type from a directory and all of its sub-directories? Like "move all *.ogg in /thisdir recursively to /somedir". I tried a couple of things; my best effort was ...