0
votes
2answers
75 views

Make directories for each file placed in main directory [duplicate]

I want to place a list of files into individual directories I create from each filename. So given the files in the root directory: Movie1.avi movie2.m4v movie3.mp4 I want to mkdir Movie1, movie2, ...
2
votes
4answers
580 views

Replace existing folder with mv command

Apologies if this question has already been asked, I couldn't find anything… Lets say I want to replace 'oldstuff' with 'newstuff'. Basically re-naming to replace. I try using this command: mv ...
0
votes
1answer
25 views

Find a directory only contained within a certain folder

I have a directory structure like: foo |__bar |__bin | |__tmp | |__bez |__tmp I need to find the tmp directory in bin/tmp, but not the one in bez/tmp. It seems to me ...
0
votes
2answers
488 views

Bash - Recursively move all files in folders with given name to their parent directory

I have a document library where all of my files are in folders based on category name but then they are also all in subfolders called 'pdf' as well. Is there a way in bash to scan through all of the ...
2
votes
2answers
65 views

How do I investigate commands being run when changing directories?

I see “awk”, “find”, “sed”, and “which” momentarily appear in my Terminal window's title when changing directories.  (And not all of these always appear and there could be some I'm missing; I imagine ...
3
votes
1answer
575 views

Can I make a custom “directory alias” like '~' in bash?

In bash I can go to my home directory with cd ~ and actually refer to my home directory with any command with ~. Can I make new, custom "directory aliases" (?) to refer to other directories? ...
0
votes
1answer
99 views

What permissions does a directory need so that anyone can cd into it but nobody but root can ls in it?

I have seen this before in some directories. Where if you know the name of a file you can open it and edit it, but you cannot ls in the directory so if you don't know the name of the file you can't ...
1
vote
1answer
36 views

Command to get to bottom of tree

Is there a Linux command that will return the file path of the bottom most dir. I've tried the following commands: find ...
1
vote
3answers
2k views

sha1sum for a directory of directories

sha1sum ./path/to/directory/* | sha1sum the above was posted as a way to compute a sha1sum of a directory which contains files. This command fails if the directory includes more directories. Is ...
2
votes
2answers
821 views

chmod: Set files to different permissions from directories

Is there away that I can run chmod to set the folders at 0755 and the files at 0644, or do I have to apply 0755 to all folders individually?
0
votes
1answer
150 views

using coreutils split file into pieces to different directories?

How can I use GNU's coreutils split command to split a large file into pieces of L number of lines each, but putting each of the different subfiles into different directories at the same time they are ...
1
vote
3answers
1k views

BASH: Need if statement to run a task only if number of files in the directory are greater than 1

I want to write a script, but I want an if statement so it will run only if the number of files in the directory are greater than 1. Is this possible?
0
votes
2answers
292 views

Search for exe file within a condition

I want to search for all .exe files greater than 200 kB or smaller than 120 kB in the current folder and its subfolders. Then I want to move them to another folder called "folder" and execute in this ...
4
votes
2answers
987 views

Watch folder and upload to an FTP server

I'm searching for some software that watches a folder and when you change a file it automatically uploads it. I don't like programs that mount a remote dir as a local folder, since they are really ...
3
votes
2answers
370 views

How to reorder folders? (as displayed in `ls -U`)

I've got a number of unordered folders on a memory stick, which my car stereo shows in order of their real position on the stick (i.e. same as ls -U) What's the easiest way of physically reordering ...
2
votes
1answer
1k views

How can I extract only some specific folders from a tar.gz archive?

Let's say I have the archive website.tar.gz, inside is the following folder structure : home -mike -www -coolwebsite file1 file2 file3 etc. When I ...
1
vote
2answers
119 views

When copying directories with sudo it copies just the first level of its hierarchy

This question was also asked here. When I copy some directory (dir) recursively with sudo in bash it copies just the first level of the dir hierarchy, but when used without sudo it copies the dir ...
0
votes
1answer
89 views

When copying folders with sudo it copies just the first level of folder's hierarchy

When I copy some directory (dir) recursively with sudo in bash it copies just the first level of the dir hierarchy, but when used without sudo it copies the dir with all its subdirs, though commands ...
2
votes
1answer
520 views

Changing the order of columns displayed with `ls`

Is it possible to change the order of displayed columns when running ls -l on *nix (or dir on Windows)? For example, I'd like to see the date modified, then the name, then other fields (or select ...
2
votes
3answers
629 views

Listing tar contents inside directory

this is the script I'm running tar tf some.tar somefolder_insidetar And output it's a list with all folders, files, and SUBDIRECTORY Files, the only thing I need it's just show the contents (folder ...
3
votes
1answer
396 views

Check folder sizes and report combined size for identical named folders in Linux

I have 2 folders that have subfolders (named after users), most subfolders exists in both folders, but not all. Now I want to create a list of space used by each user. I can use the following command ...
1
vote
2answers
2k views

Bash: Find folders with less than x files

How would I go about finding all the folders in a directory than contain less than x number of .flac files?
14
votes
4answers
2k views

Double root folder vs single root folder

On my Linux box, in bash, I have access to a "double root" folder denoted by two forward slashes: tomas:~ $ cd / tomas:/ $ ls bin/ cdrom@ ... tomas:/ $ cd // tomas:// $ ls bin/ cdrom@ ... The ...
2
votes
2answers
282 views

shell utility to check if directory is an ancestor to a file

How can I check that a given regular file of path f is a descendant of a directory of path d. If not for symlinks, I would just check if d (with a trailing slash) is prefix to f. Now with symlinks ...
8
votes
6answers
2k views

Why a folder must be executable?

Permission for files: chmod 664 myFile // rw-rw-r-- And for folders: chmod 774 myFolder // rwxrwxr-- If I only use the "read and write" permission, the folders won't show its contents, why ?
4
votes
4answers
430 views

deleting folders in linux bash

i'm trying to delete in gnu/linux all folders inside another folder that start with a "." (dot), for that i'm using the find utility, this is what i have: find . -iname ^\..* -exec rm -rf {} \; but ...
1
vote
2answers
398 views

Prevent rmdir -p from traversing above a certain directory

I hacked together this script to rsync some files over ssh. The --remove-source-files option of rsync seems to remove the files it transfers, which is what I want. However, I also want the directories ...
4
votes
3answers
179 views

Why does this bash command take up all space on device?

I'm a little new on searching via bash, so feel free to give me suggestions on the methods to use instead of this, which I'll never use again :) I'm searching for occurances of a string, recursively ...
7
votes
2answers
6k views

How do I create a shortcut that opens Cygwin bash shell on a directory of my choosing (UNC especially)?

Given a standard installation of Cygwin for Windows XP, I would like to create a standard Explorer shortcut that opens a bash shell already open on a directory of my choosing. The directory is a UNC ...
1
vote
5answers
112 views

how to navigate directories with heaps of files

My Linux file system has tens of thousands of files per directory. Viewing a list of all the files takes a few minutes for my system to calculate, which is too slow. But I am not sure what files are ...