MV exclude folder not working Announcing the arrival of Valued Associate #679: Cesar Manara ...
Error "illegal generic type for instanceof" when using local classes
What is Wonderstone and are there any references to it pre-1982?
What is the meaning of the new sigil in Game of Thrones Season 8 intro?
3 doors, three guards, one stone
Apollo command module space walk?
What is the logic behind the Maharil's explanation of why we don't say שעשה ניסים on Pesach?
Withdrew £2800, but only £2000 shows as withdrawn on online banking; what are my obligations?
How discoverable are IPv6 addresses and AAAA names by potential attackers?
Book where humans were engineered with genes from animal species to survive hostile planets
Can an alien society believe that their star system is the universe?
Understanding Ceva's Theorem
Do I really need recursive chmod to restrict access to a folder?
What does an IRS interview request entail when called in to verify expenses for a sole proprietor small business?
How to find all the available tools in mac terminal?
What exactly is a "Meth" in Altered Carbon?
How do pianists reach extremely loud dynamics?
Sci-Fi book where patients in a coma ward all live in a subconscious world linked together
How can I make names more distinctive without making them longer?
Denied boarding although I have proper visa and documentation. To whom should I make a complaint?
What is Arya's weapon design?
How to call a function with default parameter through a pointer to function that is the return of another function?
Dating a Former Employee
What is known about the Ubaid lizard-people figurines?
Why did the rest of the Eastern Bloc not invade Yugoslavia?
MV exclude folder not working
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 17/18, 2019 at 00:00UTC (8:00pm US/Eastern)
2019 Community Moderator Election Results
Why I closed the “Why is Kali so hard” questionHow do I correct a directory incorrectly copied into itself?find file, copy but with different namebash syntax error near unexpected token `(' - but everything looks like it should work'Tar' the result of a 'find', preserving the directory structureCopy tree directory from specific pointshopt -s extglob not working as expectedexecutable within $PATH still going unrecognizedHow to rename files recursively in sequential order?How can I copy a specific line to a specific folder? - Debian/Bash/LinuxBash for loop on all files in folder except one
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}
I'm trying to copy all of the files/directories inside a folder but would like to exclude one folder as I want all the other file to be inside that folder. To better demonstrate below is the folder structure
- VideosFolder
L File1
L File2
L File3
L TutorialFolder
Now I want File1
File2
File3
to be moved to TutorialFolder
like so
- VideosFolder
L TutorialFolder
L File1
L File2
L File3
I tried this command
mv ~/Desktop/VideosFolder/!(TutorialFolder) TutorialFolder
But I get this error
mv: cannot stat '/home/user/Desktop/VideosFolder/!(TutorialFolder)': No such file or directory
I checked if the shopt extglob
is enabled and it is indeed enabled. So I'm not sure how to go about this.
bash mv shopt
New contributor
add a comment |
I'm trying to copy all of the files/directories inside a folder but would like to exclude one folder as I want all the other file to be inside that folder. To better demonstrate below is the folder structure
- VideosFolder
L File1
L File2
L File3
L TutorialFolder
Now I want File1
File2
File3
to be moved to TutorialFolder
like so
- VideosFolder
L TutorialFolder
L File1
L File2
L File3
I tried this command
mv ~/Desktop/VideosFolder/!(TutorialFolder) TutorialFolder
But I get this error
mv: cannot stat '/home/user/Desktop/VideosFolder/!(TutorialFolder)': No such file or directory
I checked if the shopt extglob
is enabled and it is indeed enabled. So I'm not sure how to go about this.
bash mv shopt
New contributor
add a comment |
I'm trying to copy all of the files/directories inside a folder but would like to exclude one folder as I want all the other file to be inside that folder. To better demonstrate below is the folder structure
- VideosFolder
L File1
L File2
L File3
L TutorialFolder
Now I want File1
File2
File3
to be moved to TutorialFolder
like so
- VideosFolder
L TutorialFolder
L File1
L File2
L File3
I tried this command
mv ~/Desktop/VideosFolder/!(TutorialFolder) TutorialFolder
But I get this error
mv: cannot stat '/home/user/Desktop/VideosFolder/!(TutorialFolder)': No such file or directory
I checked if the shopt extglob
is enabled and it is indeed enabled. So I'm not sure how to go about this.
bash mv shopt
New contributor
I'm trying to copy all of the files/directories inside a folder but would like to exclude one folder as I want all the other file to be inside that folder. To better demonstrate below is the folder structure
- VideosFolder
L File1
L File2
L File3
L TutorialFolder
Now I want File1
File2
File3
to be moved to TutorialFolder
like so
- VideosFolder
L TutorialFolder
L File1
L File2
L File3
I tried this command
mv ~/Desktop/VideosFolder/!(TutorialFolder) TutorialFolder
But I get this error
mv: cannot stat '/home/user/Desktop/VideosFolder/!(TutorialFolder)': No such file or directory
I checked if the shopt extglob
is enabled and it is indeed enabled. So I'm not sure how to go about this.
bash mv shopt
bash mv shopt
New contributor
New contributor
edited 5 hours ago
Rui F Ribeiro
42.1k1484142
42.1k1484142
New contributor
asked 5 hours ago
MadzQuestioningMadzQuestioning
104
104
New contributor
New contributor
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
You could just run
mv * TutorialFolder/
While in VideosFolder/
. This will move all files and directories (not starting with a .
) into TutorialFolder/
. As you can't move a directory into itself, you will likely get a warning message along the lines of
mv: cannot move 'TutorialFolder' to a subdirectory of itself, 'TutorialFolder/TutorialFolder'
This is expected and just means that mv
hasn't moved TutorialFolder
.
This does work but it's gives a warning. I was thinking of a more cleaner way like what if I want to exclude 2 folder or more then this solution will not fix it. I was really hoping to get an answer about extglob approach as this is more flexible
– MadzQuestioning
2 hours ago
add a comment |
The other answer works but this is a cleaner way with no errors:
find . -maxdepth 1 ! ( -name TutorialFolder -o -name '.' ) -exec mv {} TutorialFolder/ ;
That will find every file and directory in the current directory where the name is not equal to TutorialFolder
and .
(which is the current directory itself) and then use -exec
to mv
them into TutorialFolder
.
add a comment |
You can try Rsync command.Rsync is a fast and versatile command line utility that synchronizes files and folders between two locations over a remote shell.
rsync -a --exclude 'TutorialFolder' ~/Desktop/VideosFolder/ ~/Desktop/VideosFolder/TutorialFolder/
New contributor
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "106"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
MadzQuestioning is a new contributor. Be nice, and check out our Code of Conduct.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f512884%2fmv-exclude-folder-not-working%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You could just run
mv * TutorialFolder/
While in VideosFolder/
. This will move all files and directories (not starting with a .
) into TutorialFolder/
. As you can't move a directory into itself, you will likely get a warning message along the lines of
mv: cannot move 'TutorialFolder' to a subdirectory of itself, 'TutorialFolder/TutorialFolder'
This is expected and just means that mv
hasn't moved TutorialFolder
.
This does work but it's gives a warning. I was thinking of a more cleaner way like what if I want to exclude 2 folder or more then this solution will not fix it. I was really hoping to get an answer about extglob approach as this is more flexible
– MadzQuestioning
2 hours ago
add a comment |
You could just run
mv * TutorialFolder/
While in VideosFolder/
. This will move all files and directories (not starting with a .
) into TutorialFolder/
. As you can't move a directory into itself, you will likely get a warning message along the lines of
mv: cannot move 'TutorialFolder' to a subdirectory of itself, 'TutorialFolder/TutorialFolder'
This is expected and just means that mv
hasn't moved TutorialFolder
.
This does work but it's gives a warning. I was thinking of a more cleaner way like what if I want to exclude 2 folder or more then this solution will not fix it. I was really hoping to get an answer about extglob approach as this is more flexible
– MadzQuestioning
2 hours ago
add a comment |
You could just run
mv * TutorialFolder/
While in VideosFolder/
. This will move all files and directories (not starting with a .
) into TutorialFolder/
. As you can't move a directory into itself, you will likely get a warning message along the lines of
mv: cannot move 'TutorialFolder' to a subdirectory of itself, 'TutorialFolder/TutorialFolder'
This is expected and just means that mv
hasn't moved TutorialFolder
.
You could just run
mv * TutorialFolder/
While in VideosFolder/
. This will move all files and directories (not starting with a .
) into TutorialFolder/
. As you can't move a directory into itself, you will likely get a warning message along the lines of
mv: cannot move 'TutorialFolder' to a subdirectory of itself, 'TutorialFolder/TutorialFolder'
This is expected and just means that mv
hasn't moved TutorialFolder
.
answered 5 hours ago
TorinTorin
47929
47929
This does work but it's gives a warning. I was thinking of a more cleaner way like what if I want to exclude 2 folder or more then this solution will not fix it. I was really hoping to get an answer about extglob approach as this is more flexible
– MadzQuestioning
2 hours ago
add a comment |
This does work but it's gives a warning. I was thinking of a more cleaner way like what if I want to exclude 2 folder or more then this solution will not fix it. I was really hoping to get an answer about extglob approach as this is more flexible
– MadzQuestioning
2 hours ago
This does work but it's gives a warning. I was thinking of a more cleaner way like what if I want to exclude 2 folder or more then this solution will not fix it. I was really hoping to get an answer about extglob approach as this is more flexible
– MadzQuestioning
2 hours ago
This does work but it's gives a warning. I was thinking of a more cleaner way like what if I want to exclude 2 folder or more then this solution will not fix it. I was really hoping to get an answer about extglob approach as this is more flexible
– MadzQuestioning
2 hours ago
add a comment |
The other answer works but this is a cleaner way with no errors:
find . -maxdepth 1 ! ( -name TutorialFolder -o -name '.' ) -exec mv {} TutorialFolder/ ;
That will find every file and directory in the current directory where the name is not equal to TutorialFolder
and .
(which is the current directory itself) and then use -exec
to mv
them into TutorialFolder
.
add a comment |
The other answer works but this is a cleaner way with no errors:
find . -maxdepth 1 ! ( -name TutorialFolder -o -name '.' ) -exec mv {} TutorialFolder/ ;
That will find every file and directory in the current directory where the name is not equal to TutorialFolder
and .
(which is the current directory itself) and then use -exec
to mv
them into TutorialFolder
.
add a comment |
The other answer works but this is a cleaner way with no errors:
find . -maxdepth 1 ! ( -name TutorialFolder -o -name '.' ) -exec mv {} TutorialFolder/ ;
That will find every file and directory in the current directory where the name is not equal to TutorialFolder
and .
(which is the current directory itself) and then use -exec
to mv
them into TutorialFolder
.
The other answer works but this is a cleaner way with no errors:
find . -maxdepth 1 ! ( -name TutorialFolder -o -name '.' ) -exec mv {} TutorialFolder/ ;
That will find every file and directory in the current directory where the name is not equal to TutorialFolder
and .
(which is the current directory itself) and then use -exec
to mv
them into TutorialFolder
.
answered 4 hours ago
Nasir RileyNasir Riley
3,0722410
3,0722410
add a comment |
add a comment |
You can try Rsync command.Rsync is a fast and versatile command line utility that synchronizes files and folders between two locations over a remote shell.
rsync -a --exclude 'TutorialFolder' ~/Desktop/VideosFolder/ ~/Desktop/VideosFolder/TutorialFolder/
New contributor
add a comment |
You can try Rsync command.Rsync is a fast and versatile command line utility that synchronizes files and folders between two locations over a remote shell.
rsync -a --exclude 'TutorialFolder' ~/Desktop/VideosFolder/ ~/Desktop/VideosFolder/TutorialFolder/
New contributor
add a comment |
You can try Rsync command.Rsync is a fast and versatile command line utility that synchronizes files and folders between two locations over a remote shell.
rsync -a --exclude 'TutorialFolder' ~/Desktop/VideosFolder/ ~/Desktop/VideosFolder/TutorialFolder/
New contributor
You can try Rsync command.Rsync is a fast and versatile command line utility that synchronizes files and folders between two locations over a remote shell.
rsync -a --exclude 'TutorialFolder' ~/Desktop/VideosFolder/ ~/Desktop/VideosFolder/TutorialFolder/
New contributor
New contributor
answered 27 mins ago
gopikagopika
1
1
New contributor
New contributor
add a comment |
add a comment |
MadzQuestioning is a new contributor. Be nice, and check out our Code of Conduct.
MadzQuestioning is a new contributor. Be nice, and check out our Code of Conduct.
MadzQuestioning is a new contributor. Be nice, and check out our Code of Conduct.
MadzQuestioning is a new contributor. Be nice, and check out our Code of Conduct.
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f512884%2fmv-exclude-folder-not-working%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown