date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,454,433,430,000 |
I'm trying to install mono on my open suse linux.
I downloaded the latest rpm packages from the mono page
and tried to install the mono-core package with the --test attribute
rpm -ivh --test /home/martin/Downloads/mono-core-3.2.3-0.x86_64.rpm
but got an error saying:
error: Failed dependencies:
mono(System.C... |
The mono documentation is not very clear on exactly how to install the packages they provide: install the packages "mono" ... while there is no single package with that name.
One of the multitude of packages you have to download probably provides mono as a virtual package, providing the dependency your installation at... | Installing mono on open suse |
1,454,433,430,000 |
I have mono 2.10.9 installed on a VM with openSuse version 12.2. I'm trying to find a distribution for the latest v3 Release of Mono which I can use to upgrade the version of mono that I have installed. I cannot find any distribution of Mono 3 for openSuse and I'm wondering how to go about upgrading to Mono 3 (if it's... |
Check the Mono:Factory project in OBS - it's not considered stable yet. You can also get there from the opensuse package directory - click "select other versions" then "show unstable versions".
| How to upgrade to “Mono v3” on openSuse 12.2 |
1,454,433,430,000 |
I'm trying to install mod_mono on Linux Mint Maya/Cinnamon.
I can't seem to find any tutorials or anything on how to do this.
So far, XSP and MonoDevelop seem to be working. I created an MVC solution, started it and it seemed to work fine.
I am also new to apache. This is a learning experience for me. :)
Can someone ... |
The apt-cache utility has the ability to search for packages. Currently, apache modules are in the form of libapache2-mod-<module name>.
On my Debian system:
$ apt-cache search libapache2-mod-mono
libapache2-mod-mono - Apache module for running ASP.NET applications on Mono
mono-apache-server1 - ASP.NET 1.1 backend for... | How to install mod_mono on Linux Mint? |
1,454,433,430,000 |
I have a virtual machine running of openSuse 11.2 that has mono 2.6.4, I use this VM as a test server to test asp.net applications under Apache mod_mono.
I wanted to upgrade (in the same virtual machine) to mono 2.8.2. I downloaded several rpm files from http://ftp.novell.com/pub/mono/download-stable/openSUSE_11.2/i58... |
Go to this page at opensuse.org and click "1-Click Install" button on mono-complete-2.8.2 meta package. Then all your loop dependencies will be solved automatically by YaST manager.
It is a usual user-friendly way to install packages on openSuSE.
| How to upgrade mono on openSuse |
1,602,532,970,000 |
How can I install the latest release of Mono in Ubuntu Saucy?
In order to develop in a free OS, I need to setup Mono (that now supports .NET 4.5). This is what I did:
Download and uncompress mono-mono-3.2.5
Run ./autogen.sh --prefix=/usr/local (finished ok)
Run make, but it exit with error checking dependencies:
ter... |
It needed to have another instance of mono already installed, so apt-get install mono-gmcs did the job. Then, a new error appeared, and the only solution seemed to be using the GitHub package:
git clone git://github.com/mono/mono.git
cd mono
./autogen.sh --prefix=/usr/local
make
make install
Now I have installed the ... | How to install Mono v3+ in Ubuntu? |
1,602,532,970,000 |
I am using Apricity OS (based on Arch Linux). I want to install Dot Net Core. What is the command for installing it by pacman.
|
In order to install dotnet-cli, you could use yaourt that helps to build and install AUR packages.
You can proceed like this :
Add to /etc/pacman.conf
[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch
Update pacman and install yaourt:
sudo pacman -Sy yaourt
Next install dotnet-cli using:
ya... | How do I install Dot Net Core on Arch Linux |
1,602,532,970,000 |
I am following the mono installation tutorial. First I add repo to list, then I import key and finally I try to update the repos.
On last step I get error:
W: Failed to fetch http://download.mono-project.com/repo/debian/dists/wheezy/main/binary-amd64/Packages Hash Sum mismatch
E: Some index files failed to download.... |
2 days ago It was working, today I am also having same problem.
But I think hash file is incorrect @ mono-project site.
If you check file size or create hash file for Packages file you can see that it is not same as hash file.
binaries
http://origin-download.mono-project.com/repo/debian/dists/wheezy/main/binary-amd64/... | Why do I get Hash Sum mismatch error when trying to install mono on debian |
1,602,532,970,000 |
I installed monodevelop from the repositories because I want to try the mono-D plugin, but when I go to the Gallery in Add-in Manager, it says "No add-ins found"
I tried adding http://mono-d.alexanderbothe.com/ as a repository, but it requires monodevelop version 2.95 and the one in the repository is version 2.6:
The ... |
It looks like monodevelop 2.95 is a development release, so won't find it in the repository. Monodevelop 3.0 has just been released (May 14, 2012). I think this is the version you need. You can download it from MonoDevelop web page. No prebuilt package is available for Ubuntu/Mint right now, so you best option is to b... | how to install monodevelop with d language add-in on Mint 12 |
1,602,532,970,000 |
I haven't updated KeyPass 2.x (I'm still on 2.32), so what could have broken this program on Linux Mint 18.1 x64?
It used to be that normal Ctrl+[letter] shortcuts like Ctrl+C to copy, Ctrl+U to open URL in browser, etc. worked fine on this system. Now none of them do. I have to right-click and use context menu opt... |
I just switched to KeePassXC 2.2.0 (oldstable) and it works fine in the above regard, and was able to open existing database files from KeePass2.
This doesn't really answer the question as to what caused the above, but it's a useful solution, at least.
| Why do [Ctrl]+[letter] shortcuts suddenly not work anymore in KeePass 2.x under Linux Mint, while most other programs are fine? [closed] |
1,602,532,970,000 |
I would like to find a Ubuntu Linux 16.04 systen command similar to strace to find out why my C++ program , ServiceController.exe , which
[execle ("/usr/lib/mono/4.5/mono-service","/usr/lib/mono/4.5/mono-service",
"./Debug/ComputationalImageClientServer.exe",
0, char const* EnvironmentPtr)]
myst... |
Use the GNU debugger, gdb, or something similar.
| Why does Ubuntu 16.04 execle of a specfic C# image halt after 90 seconds while others run 24X7? |
1,602,532,970,000 |
Question:
I want to install mono3 from here:
http://download.mono-project.com/archive/3.0.3/linux/x64/
How can I add this link to the appropriate OpenSuse package installation program ?
I tried zypper ar http://download.mono-project.com/archive/3.0.3/linux/x64/ mono3
but that yields "Repository type cannot be determin... |
Although the process used to find it would make you think it is, it isn't actually a repository, it is in fact just a simple file-share. In this situation, your best bet would be to remove all your openSUSE-provided mono packages (zypper rm), lock them (zypper al), and install (zypper in) the packages from the mono-pr... | Adding openSuSe mono repository? |
1,602,532,970,000 |
Mono 3.0 has been released yesterday. I am really excited by this release and am curious to know when this will be available in Debian testing (Wheezy).
Is there a standard timeline set by Debian project for when the newest release of a software will be made available into Testing or in general any of the branches, ex... |
Currently, Debian testing is in a freeze state. This means that new uploads must be approved by the release team, and generally must fix RC (release critical) bugs. It is very rare for the release team to accept new upstream releases (rather than patches specifically for RC bugs) after the freeze.
So the answer to thi... | How soon do new releases get packaged into Debian Testing? |
1,602,532,970,000 |
I installed mod-mono on debian via apt-get install mono-apache-server2...
But when i do apt-get install mono-apache-server4 it gives me:
E: Unable to locate package mono-apache-server4
Anyone know how I can get mono-apache-server4 on there?
|
That package doesn't exist in the current Debian stable (Squeeze), but it's in testing (Wheezy). You could compile it yourself or try to find a backport, but the easiest might be to just install Wheezy, which is getting close to becoming the new stable anyway.
| How to get mono-apache-server4 on debian |
1,602,532,970,000 |
I have a Web API that is using .NET 4.0 which I'm now trying to deploy on Debian.
I've followed a few tutorials on how to do this, e.g. Running ASP.net Web API Services under Linux and OSx.
$ /etc/nginx/sites-available/default:
server {
listen 80;
root /var/www/API/;
index index.ht... |
The warning is generated because you have two SCRIPT_FILENAME lines in your /etc/nginx/fastcgi_params file. The original value and the new value you added. You should comment out the old value to suppress the warning message.
The error is generated because the syntax of your fastcgi-mono-server4 command invocation is ... | Encountering issues when trying to host an ASP.NET Web Api on Debian using Mono and Nginx |
1,602,532,970,000 |
I use KEEProg_24xxx_03c to control an EEPROM programmer through USB. This has worked great for years.
However, now it complains:
$ mono ./KEEProg_03c.exe
WARNING: The runtime version supported by this application is unavailable.
Using default runtime: v4.0.30319
Unhandled Exception:
System.IO.FileNotFoundException: C... |
I need runtime v2.0.50727:
$ ikdasm KEEProg_03c.exe | head -n 2
// Metadata version: v2.0.50727
This answer: https://stackoverflow.com/questions/33508922/mono-on-macosx-the-runtime-version-supported-by-this-application-is-unavailab/33517383#33517383 suggests:
$ mono --runtime=2.0 ./KEEProg_03c.exe
which works.
| 24xxx programmer tool fails: Mono library downgrade? Other options? |
1,602,532,970,000 |
I am running NUnit tests on Ubuntu via mono. They require the certmgr tool to install certificates and keys that the tests utilize. The user cert/key I can install fine, but the tests fall over if the CA certificate is not installed in the MACHINE rather than LOCAL USER Trust store.
However, the Machine store requires... |
The machine store keys and certificates are stored in the root user's home directory:
/root/.config/.mono/
However, when I chmod'd the subdirectories there to provide access to the user in question, it didn't work, I still got permission denied.
Instead, I'm taking dave_thompson_085's tip. I gave the user sudo access... | Can I reduce the privileges level on mono's certificate machine store? |
1,602,532,970,000 |
Do I need to worry what version of OS software runs on and what the software requirements are? Can I can install any Windows software on Mono or Wine without worrying about compatibility?
|
Those emulators are not perfect. Try the application you want to use, but it may take some tweaking to get it working correctly. See WineHQ's support page and Mono's Documentation for help to get them working.
| Do I need to worry about software compatibility at all if I use Mono and Wine? |
1,602,532,970,000 |
I just discovered something really surprising.
I can compile a simple C# hello world on my windows computer using csc (from Visual Studio), copy the resulting exe file to my Linux computer, and execute it with mono helloworld.exe. So far, everything makes sense to me: according to this SO post, on Windows, helloworld... |
You most definitely have either Wine or/and Mono installed via a package manager and along with it a special configuration file which tells the kernel what to do once the user launches an exe file.
More on it here: https://en.wikipedia.org/wiki/Binfmt_misc
| How did Linux load this exe compiled with C#? [duplicate] |
1,602,532,970,000 |
How can I fix this issue:
(base) jaakko@jaakko-GL553VW:~/Desktop/Programming$ sudo apt install synaptic
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt --fix-broken install' to correct these.
The following packages have unmet dependencies:
mon... |
apt already tells you what you should try next:
You might want to run 'apt --fix-broken install' to correct these.
If that fails for some reason, or doesn't fix your issue, please update the question with the output of that command.
| Installing mono messed something on my computer |
1,602,532,970,000 |
I used MonoDevelop to write a small C#-program that moves directories and files from one location to another location, but I messed it up a bit.
I used C#'s DirectoryInfo.MoveTo(path1, path2); to move the folder, but I forgot to specify the actual parent folder of path2.
The initial situation was like this: I have a s... |
It's under the directory that was the current working directory of the Mono process that executed the move.
| Moved a directory to a non-existing location? |
1,602,532,970,000 |
I would like to know how to start up k=10 Apache2 server processes upon Ubuntu 16.04 alpha release reboot. Yesterday, I read this URL, [https://rudd-o.com/linux-and-free-software/tuning-an-apache-server-in-5-minutes], which says to use Apache2 with the prefork.c module and set StartServers equal to 10
<IfModule prefor... |
First you can confirm that you already have the mpm_prefork module by seeing that's shipped in the apache2 package in 16.04. You'll see a couple results for it if you do this:
dpkg -L apache2 | grep fork
/etc/apache2/mods-available/mpm_prefork.conf
/etc/apache2/mods-available/mpm_prefork.load
Now check which MPM ... | How to start up k=10 Apache2 server processes upon Ubuntu 16.04 alpha release reboot? |
1,602,532,970,000 |
When we start in the mono-service mode on Ubuntu Linux 16.04 in the background, we would like to create and store a log file at wherever the user wants. I tried this URL,
stackoverflow.com/questions/11024474/capture-mono-service-stdout-console-output
where it says do this:
mono-service2 myservice.exe -l:/var/run/test ... |
The C program performs the equivalent of this script:
#!/bin/bash
export LD_LIBRARY_PATH=.
exec /usr/lib/mono/4.5/mono-service.exe Audio_Video_Recorder.exe --debug '>&' LOGCamster.txt
echo "Oops!" >&2
exit 255
Notice that the >& and LOGCamster.txt are passed as literal arguments to your command line. Specifically, >&... | Problems creating log file of mono-service assembly output |
1,602,532,970,000 |
What are the other Mono dependencies besides mono-runtime and libmono-system-windows-forms4.0-cil required to run C# Windows Forms applications on Ubuntu Linux 16.04?
Does the answer to our question depend on the C# source code for our Windows Forms applications? For example, hellboy81 wrote on gitter im mono, Feb 1... |
The problem here is that your Mono applications are, just like any other source code, outside of the package management system's control. Therefore you need to work out yourself which packages you need to install - nothing will tell you.
You have a few options and the simplest of those is to read the developer's docu... | What are all the Mono dependencies required to run all types of C# Windows Forms applications? |
1,602,532,970,000 |
When first tried use Wine it asked me to install .NET packages, and other something for HTML, so i did. Later I delete wine, and few days latter reinstalled it. When I tried to use Wine it didn't asked me any more to install .NET packages. So it means it has already one in my system. When googling, I found that it is ... |
That is two very separate questions.
First, wine and viruses. The truth is that when running wine you are allowing windows programs to run inside Linux. In theory this allows viruses too. There are some real limits, for example wine doesn't have direct access to hardware, and it's C:\ drive is just a folder in your h... | Is it safe to have .NET packages on Mint 17.1? How can I delete it? |
1,486,376,427,000 |
I used the command
mv folder_name ....
I thought by using .. twice, it would move it back two folders.
Unfortunately my files disappeared.
I need to recover them.
|
Your directory is still there :)
You have renamed it ....
Because files whose names start with . are hidden, you cannot see the directory unless you display hidden files
run
ls -A
and there it is!
Revert the change:
mv .... original_folder_name
and do the move correctly
mv original_folder_name ../..
| Wrong mv command. Where did my files go? [duplicate] |
1,486,376,427,000 |
I have this grep command to find files without the word Attachments in them.
grep -L -- Attachments *
I want to move all the files that are output from that command. How do I do that in bash? Do I use a pipe? Do I use a more wordy if/then statement in a full-on script?
|
If you know that none if the file names contain new lines, tabs, spaces or glob combinations that may produce a match, this may be easier for a one off case:
mv $(grep -L Attachments *) dest_dir
| How do I move all files output from a command? |
1,486,376,427,000 |
How can I check if mv is atomic on my fs (ext4)?
The OS is Red Hat Enterprise Linux Server release 6.8.
In general, how can I check this? I have looked around, and didn't find if my OS is standard POSIX.
|
Interestingly enough, it seems the answer may be, "It depends".
To be clear, mv is specified to
The mv utility shall perform actions equivalent to the rename()
function
The rename function specification states:
This rename() function is equivalent for regular files to that
defined by the ISO C standard. Its inc... | Is mv atomic on my fs? |
1,486,376,427,000 |
I have to move some files from one filesystem to another under Ubuntu. However, it is very important that the files never exist as partial or incomplete files at the destination, at least not under the correct file name.
So far, my only solution is to write a script that takes each file, copies it to a temporary name ... |
rsync copies to temporary filenames (e.g. see Rsync temporary file extension and rsync - does it create a temp file during transfer?) unless you use the --inplace option. It renames them only after the file has been transferred successfully. rsync also deletes any destination files that were only partially transferr... | Approximating atomic move across file systems? |
1,486,376,427,000 |
I have two folders on the same partition (EXT2)
If I mv folder1/file folder2 and some interruption occur (e.g. power failure) could the file system ever end up being inconsistent?
Isn't the mv operation atomic?
Update:
So far on IRC I got the following perspectives:
it is atomic so inconsistencies cannot happen
first... |
First, let's dispel some myths.
it is atomic so inconsistencies cannot happen
Moving a file inside the same filesystem (i.e. the rename) system call is atomic with respect to the software environment. Atomicity means that any process that looks for the file will either see it at its old location or at its new locati... | Can the filesystem become inconsistent if interrupted when moving a file? |
1,486,376,427,000 |
I have a folder A which has files and directories, I want to move all those files and directories to another folder B, except file, file2, directory, and directory2.
How can this be done?
|
With zsh:
setopt extendedglob # best in ~/.zshrc
mv A/^(file|directory)(|2)(D) B/
(the (D) to include dot (hidden) files).
With bash:
shopt -s extglob dotglob failglob
mv A/!(@(file|directory)?(2)) B/
With ksh93
(FIGNORE='@(.|..|@(file|directory)?(2))'; mv A/* B)
| Linux command line. Move all files and directories in directory, except some files and directories |
1,486,376,427,000 |
I't trying to move around 4.5 million files (size ranges from 100 - 1000 bytes) from one partition to other. The total size of the folder is ~2.4 GB
First I tried to zip it and move the zipped file to the new location. It is able to paste only ~800k files and shows "out of space" error.
Next I tried the mv command and... |
I have found the reason for the error (found it on a different forum).
The error was due to the hashing algorithm used by ext4 which is enabled by "dir_index" parameter. There were too many hashing collisions for me so I disabled it by the following command:
tune2fs -O "^dir_index" /dev/sdb3
The downside is that my p... | Moving millions of small files results in "out of space" error |
1,486,376,427,000 |
I'm trying to rename some files on my Synology Diskstation via SSH. The available shell is the BusyBox built-in shell:
BusyBox v1.16.1 (2013-04-16 20:13:10 CST) built-in shell (ash)
The move command always yields two errors when I try using a space character either in the source or destination filename. Escaping spa... |
As you added, the mv command is a script in /bin/mv with this last line:
/bin/busybox mv $@
This line is missing quotation marks around $@:
/bin/busybox mv "$@"
$@ denotes the list of parameters given to the script. Quoting this variable has the special meaning that, when expanded, every parameter will be quoted se... | Rename files with spaces in a BusyBox shell |
1,486,376,427,000 |
Example script:
#!/bin/sh -e
sudo useradd -m user_a
sudo useradd -m user_b -g user_a
sudo chmod g+w /home/user_a
set +e
sudo su user_a <<EOF
cd
umask 027
>> file_a
>> file_b
>> file_c
ls -l file_*
EOF
sudo su user_b <<EOF
cd
umask 000
rm -f file_*
ls -l ~user_a/
set -x
mv ~user_a/file_a .
cp ~user_a/file_b .
ln ~u... |
Which system are you running? On Linux, that behaviour is configurable, through /proc/sys/fs/protected_hardlinks (or sysctl fs.protected_hardlinks).
The behaviour is described in proc(5):
/proc/sys/fs/protected_hardlinks (since Linux 3.6)
When the value in this file is 0, no restrictions are placed
... | Why can I not hardlink to a file I don't own even though I can move it? |
1,486,376,427,000 |
I need a way to search directories for child directories with the same name and then move all files in the child directory to the parent.
Thus from
/recup-dir1/recup-dir1/files to /recup-dir1/files.
The child directories can be left empty because i can use something like
find . -type -d -empty -delete
to delete all em... |
With zsh, you could do:
for dir in **/*(NDodoN/e['[[ $REPLY:t = $REPLY:h:t ]]']); do
contents=($dir/*(NDoN))
(( $#contents == 0 )) ||
mv -- $contents $dir:h/ &&
rmdir -- $dir
done
Where:
**/*(qualifiers) recursive globbing with glob qualifiers
N: nullglob: don't complain if there's no match
D: dotglob: i... | Parent child directory same name , move files to parent directory |
1,486,376,427,000 |
I have a directory which contains multiple directories including subdirectories too. I want to move some of them to a single one at the same time (with one command)
Example
Main Directory
Sub1
Subsub1
Subsub2
Sub2
Subsub1
Subsub2
Sub3
Subsub1
Subsub2
... |
Assuming that "Main Directory"/Test exists:
mv "Main Directory"/Sub[1-3] "Main Directory"/Test
The only thing happening here is that you move the directories into the Test directory. The files in Sub1, Sub2 and Sub3 will still be available in those same directories, but now under the new path "Main Directory"/Test/S... | move multiple directories in one directory - recursively |
1,486,376,427,000 |
I have an QNAP TS-210 NAS and it seems, that there's a Debian Linux on board. I've installed Midnight Commander there and have been using it successfully for years. Today I spotted something weird.
I have to move a large collection of movies (around 130 GB) from one folder to anther. Movies are split into many subfold... |
mv works in two ways. mc moves behave the same way.
If the files are on the same logical device (partition or disk), only the directory entries are moved. This can be extremely fast.
If the files are on different logical devices, the files are copied and the old file deleted after the copy is done. This is relati... | Midnight Commander moves files enormously long |
1,486,376,427,000 |
Sorry if it sounds confusing, but this is not a biology inquiry. I'm planning to switch to Linux, but I have a few questions need answered. If a single monitor is mirrored like described in this link, then will we see the pointer onscreen move similarly to, or contrarily to our physical mouse-hand movement? In case it... |
The actual command described in the OP's link is xrandr --reflect [x|y|xy]. Its intended uses are for e.g. when you are displaying on a projector that's mounted upside down to the ceiling, and/or projecting to a through-projection screen so the image needs to be flipped to be right-way-round for the viewers.
In both c... | How would the mouse behave in a mirrored environment? |
1,486,376,427,000 |
Currently I use three steps to gzip some static assets and then use s3cmd to an S3 bucket (technically it's a Digital Ocean Spaces bucket). Here's what I do:
$ find . -type f -name '*.css' | xargs -I{} gzip -k -9 {}
$ find . -type f -name '*.css.gz' | xargs -I{} s3cmd put --acl-public --add-header='Content-Encoding: ... |
You can use the -exec action in find so that you can do shell string manipulation on the filename. The parameter expansion "${var%.*}" can be used to remove the extension. Below is an example.
find . -type f -name '*.css.gz' -exec bash -c 's3cmd put --acl-public --add-header="Content-Encoding: gzip" "$1" "s3://mybucke... | Find files then move them and rename them at the same time? |
1,486,376,427,000 |
When trying to move some folder I am getting error: "cannot move File exists"
export BACKUP_DIR=/backup
mv -f $BACKUP_DIR/scripts $BACKUP_DIR/scripts_old
Getting error:
mv: cannot move '/backup/scripts' to '/backup/scripts_old/scripts': File exists
I've tried with -f option but without it as well - same error.
How... |
I think this cannot be done without a separate removal.
rsync allows to a) remove source files (but files only) via --remove-source-files and b) delete files in target that do not exist in source (--delete). Best to be used with -nv to make a verbose dry-run. Depending on the version of rsync, -recursivity may be nee... | mv: cannot move "File exists" |
1,486,376,427,000 |
I tried moving a file in Linux from one directory to another and accidentally had an extra > character.
mv /u01/app/oracle/product/12.1.0.2/db_1/dbs/>test2.dbf /u01/shared_data/oradata/TEST/test.dbf
Now, my entire dbs folder is missing. However when I locate the dbs folder /u01/app/oracle/product/12.1.0.2/db_1/dbs... |
The > here redirects stdout to a file, like it would in a more normal use case:
printf "%s\n" "hello world" > filename
The spaces around > are optional, and it doesn't have to go at the end. This does the same:
printf "%s\n">filename "hello world"
So your mv line would more conventionally be written:
mv /u01/app/or... | Had an extra > character when moving a file, now the folder is missing |
1,486,376,427,000 |
How do you move all the files (excluding sub-directories) from one directory to another. I'd prefer if the solution used just basic shell scripting.
|
The easy way:
for f in /some/path/*; do
if [ -f "$f" ]; then
mv "$f" /some/other/path
fi
done
The slightly more complicated way:
find /some/path -mindepth 1 -maxdepth 1 -type f -exec mv {} /dome/other/path \;
| How to move all files (excluding sub-directories) from one directory to another? |
1,486,376,427,000 |
I have tar.gz files accessible from
./parent/subfolder/tar_file_folder/*tar.gz
And I want to find them and move them into the ./parent/ directory, therefore one level up. However, there are several subfolders and tar_file_folders. Therefore, I want to call my command from the parent folders.
I have tried this comman... |
You could iterate on tar files and move them to parent directory '..', like that:
for tar in $(find path -name '*.tar.gz'); do mv $tar $(dirname $tar)/..; done
| Find all tar.gz files and move them to a one level down directory |
1,486,376,427,000 |
I'm trying to figure out if there's a way to use a bash or python script to tell if my laptop gets moved. I had the idea of using wifi signal strength to do it, but the problem with that is that you have to be pretty far from the router before the signal drops off.
One idea I had was to somehow use a Raspberry Pi wit... |
See https://www.kernel.org/doc/Documentation/misc-devices/lis3lv02d.
The DV7 should have the mentioned accelerometer. I can't come up with a specific implementation but the Thinkpad community came up with some ideas for their model (with a different driver).
Just as a starter:
http://www.thinkwiki.org/wiki/Script_for_... | Is it possible somehow to tell if a laptop is moved in a bash or python script? |
1,486,376,427,000 |
I have:
$ find 1 2 -printf '%i %p\n'
40011805 1
40011450 1/t
40011923 1/a
40014006 1/a/e
40011217 1/a/q
40011806 2
40011458 2/y
40011924 2/a
40013989 2/a/e
40013945 2/a/w
I want:
<inode> <path>
any 2
40011450 2/t
40011458 2/y
any 2/a
40014006 2/a/e
40011217 2/a/q
40013945 2/a/w
How do do it?
|
Already answered.
Here is version adapted to this task:
D=$(readlink -f "2"); (cd "1" && find . -type f -print0 | cpio --pass-through --null --link --make-directories "$D") && rm -Rf 1
After this command I have exactly what I wanted:
$ find 1 2 -printf '%i %p\n'
find: `1': No such file or directory
40011806 2
4001145... | How do I merge (without copying) two directories? [duplicate] |
1,486,376,427,000 |
I have a file strings.txt with a list of strings:
GCA_001677475.1
GCA_003410275.1
GCA_002310615.1
GCA_000007405.1
GCA_000219515.3
And I have many files in a directory with names like:
GCA_000005845.2_ASM584v2_protein.faa
GCA_000006925.2_ASM692v2_protein.faa
GCA_000007405.1_ASM740v1_protein.faa
GCA_000007445.1_ASM744v... |
This is a possible solution:
cat strings.txt | xargs -I '%' find . -type f -name "%*" -exec mv -t your_path {} +
Moved GCA_000007405.1_ASM740v1_protein.faa that is the only match.
| How to move all files with names starting with a string from a list? |
1,486,376,427,000 |
I'm having trouble with moving files in a bash script.
I've been trying different solutions that I've found here, on the same problem, but can't find anything that works..
my last attempt was adding shopt -s dotglob nullglob but that didn't solve anything..
In this test,
jdir0="/media/sf_Mediaserver3/test22/abbamax.(6... |
* is a glob operator of the shell. It needs to be left unquoted to be recognised as such. When quoted, /media/sf_Mediaserver3/test22/abbamax.(6th.copy)..kansas.(1999)/* is passed literally to mv and mv tries to move that file called *, and there's no such file.
So you need:
mv -v -- "$jdir0"/* "$jdir0/subs/" >> "$debu... | Moving files with " and * caused error |
1,486,376,427,000 |
I have several files like these:
2020.001.00.01.pcc1_TBTZ_TBTZ_1.0-3.0.sac
2020.001.03.04.pcc1_TBTZ_TBTZ_1.0-3.0.sac
2020.002.00.01.pcc1_TBTZ_TBTZ_1.0-3.0.sac
2020.003.00.01.pcc1_TBTZ_TBTZ_1.0-3.0.sac
2020.004.00.01.pcc1_TBTZ_TBTZ_1.0-3.0.sac
2020.004.05.06.pcc1_TBTZ_TBTZ_1.0-3.0.sac
2020.005.00.01.pcc1_TBTZ_TBTZ_1.0-... |
Everything can be done much simpler if using bash's abilities:
#!/bin/bash
for file in *.sac
do
year=${file:0:4}
day=${file:5:3}
range_start=$(( (($day-1)/3)*3+1 ))
range_end=$(( $range_start+2 ))
ndir=$(printf "%04d.%03d.%03d" $year $range_start $range_end)
mkdir -p archive/$ndir
... | How to move every three day file based on the filename to respective folders in bash |
1,486,376,427,000 |
I have tar.gz files like below in a directory df:
A.tar.gz
B.tar.gz
C.tar.gz
D.tar.gz
E.tar.gz
F.tar.gz
G.tar.gz
I also have text file move.txt with following columns information:
ID Status Status2 Status3 Status4 Status5 tar sample
ID1 Negative Negative Negative Negative Negat... |
bash + awk solution:
for f in $(awk 'NR > 1{ print $7 }' move.txt); do
[[ -f "$f" ]] && mv "$f" ~/destination
done
Or with xargs:
awk 'NR > 1{ print $7 }' move.txt | xargs -I {} echo mv {} ~/destination
The crucial awk operation implies:
NR > 1 - start processing from the 2nd line (skip the 1st one as header... | How to move the files to new directory based on names in text file? |
1,486,376,427,000 |
I have a remote Debian test server to which I connect via SSH (Putty client). I wanted to move a lot of files on a remote machine to another folder:
remote: /mnt/a/ -> remote: /mnt/b/c/
RESULT@remote: /mnt/b/c/a/
I've used a move (mv) command connecting to a remote computer with SSH from my local computer:
mv /mnt/a/... |
As long as your source and destination paths are on the same filesystem, mv won't actually "move" anything. It'll just edit your directories' and files' metadata (inodes and links), but the data blocks themselves won't move. For instance, assuming that /home and /srv are on different filesystems, you'll observe the fo... | Moving files from folder to folder on a remote server using SSH without downloading those to local computer |
1,486,376,427,000 |
I'm looking for some way to organize the files contained in directory b to make its structure equal to that of directory a (which contains the same files as b, just arranged in a different way), without copying or moving anything from directory a. That way seek some advanced use of mv command with output from awk or/a... |
Assuming, for simplicity, that your original data is in directory a:
a
├── d1
│ ├── f1
│ └── f2
└── d2
├── f3
└── f4
and that you have a directory b which contains the same files as a, organized as a different directory structure:
b
├── d1
│ └── f3
├── d2
│ ├── f1
│ └── f2
└── d3
└── f4
To rear... | Organize directory b and its subdirectories files equal as directory a without copying or moving from directory a |
1,663,035,968,000 |
I am currently trying to write a script that organizes a list of files into subdirectories by their dates. The dates are contained on the first line of every file in the format YYYY-MM-DD. I have extracted the first line from every file using the head command and replaced the - with / so it becomes YYYY/MM/DD. This is... |
The following should do:
for file in ~/fileList/*
do
newpath=$(head -1 "$file" | tr '-' '/')
mkdir -p "$newpath"
echo "would now execute 'mv $file $newpath'"
done
This will store the transformed date in the variable $newpath and create that directory along with any missing parents if it doesn't yet exist.... | Organizing files by dates contained within them |
1,663,035,968,000 |
I have a bunch of directories that contain MP3 files inside. These directories contain no other directories inside.
How do I delete all directory structure without deleting the files?
That would be basically move all files found inside these directories to the current directory. The current directory is the directory ... |
With find and single linear:
find . -mindepth 2 -type f -execdir sh -c 'mv -vt ../ "$@" ; rmdir "$PWD"' _ {} +
-mindepth 2 will let the find command to ignore current directories' files.
-execdir this is important here, and this make find to change the current directory to the directory where a file found and the co... | copying files recursively without preserving directories |
1,663,035,968,000 |
I was moving a directory on my parents computer using a teamviewer session. The session responds slow and somehow, when I was moving the directory (location:
/sdb/synchronisatie/nel/) something went wrong I guess but now the directory is gone! And I cannot find it anywhere...
I'm sure I've used 'paste' but I think no... |
From your description it sounds like you likely dragged your files into another directory. To locate them you can wait a day and there's typically a cron job that runs on most distros that does a index of the files on your system using slocate. Once this completes you can locate your files using the locate command:
$ ... | lost directory cannot find it with testdisk |
1,663,035,968,000 |
I recently upgraded Thunderbird to version 115.0.1 and since then, the MOVE TO dropdown doesn't work when I am reading an e-mail.
I am referring to this option:
When I browse my e-mails (without opening the mail itself), and I use this dropdown, the e-mail that is selected will move to the chosen folder just fine. Ho... |
I can't provide a solution or a workaround, but I guess I can explain it:
As with every major version in recent times, in TB 115, the TB folks have managed to break all sorts of things that had been working in previous versions. There are still dozens of new bugs of various severity in TB 115, and I am quite sure that... | Can't move opened e-mails in Thunderbird |
1,663,035,968,000 |
I have 1 x big folder that has lots of .txt files
I am trying to group these .txt files in separate subfolders based on specific rules from a rules.csv file (on what subfolder they belong to):
LARGE FOLDER:
file1.txt
file2.txt
...
file100.txt
The rules would be:
file1.txt
file3.txt
file8.txt
belong to "subfolder1"
fil... |
Assuming your files has no whitespaces in their name as shown in your question which they don't, then you could use a simple shell-loop to move the files into thier corresponding directories in the second column.
while IFS=' ' read -r fileName dirName; do
mkdir -p "./$dirName" && mv "./$fileName" "./$dirName";
don... | Move files in subfolders based on the specific rules from a file |
1,663,035,968,000 |
How can I move the entire folder up one level in the directory structure ? Using rsync or mv does not quite work.
rsync /var/www/html/wordpress/ /var/www/html/
skipping directory .
mv /var/www/html/wordpress/ /var/www/html/
mv: '/var/www/html/wordpress/' and '/var/www/html/wordpress' are the same file
|
Use a wildcard and remove the directory afterwards:
mv /var/www/html/wordpress/* /var/www/html/ && rm -r /var/www/html/wordpress
| Move files up one directory |
1,663,035,968,000 |
Suppose that I have only the following in ~/foo:
.
..
foo
With file managers if I cut the subfolder foo and paste it into ~ it automatically replaces the contents of ~/foo with that of ~/foo/foo.
But is there a native command-line tool to do so, although I can achieve the goal with a function, too?
|
I don’t know any way to do it in one step,
but the easiest way around the problem is to remove the problem.
The fact that the two directories have the same name is a problem;
so, rename one of them:
mv foo foo2 && mv foo2/foo foo && rmdir foo2
| How do I replace a folder with its only subfolder of the same name in CLI? |
1,663,035,968,000 |
I have 3 massive folders containing lots of other folders that I need to give access to a third party for downloading via SFTP.
At the moment every folder in the main directory is set for download rights for SFTP so my idea is to make a list.txt containing the files that the user can not access and set the permissio... |
You can avoid the slow bash loop with something like this, which seems to works ok in my tests:
$ tr '\n' '\0' <file1 |xargs -0 -I{} mv -vt path/to/deny {} #v for verbose.
#OR
$ cat file1 |xargs -d'\n' -I{} mv -vit path/to/deny {} # set delimiter to new line
For a dry run you can make a test like this
cat file1 |xa... | Change permission of folder based on list.txt |
1,663,035,968,000 |
I have a directory with the following layout (the layout in Directory 1 is repeated in every other Directory <num>):
Parent directory
Directory 1
some directory
another directory
<many files>
Directory 2
︙
Directory 3
Directory 4
I'd like to rename the files by prefixing t... |
First of all,
I can’t reproduce the results you claim for the command you showed.
I got the files being renamed to another directory_file1.jpg,
another directory_file2.jpg, etc.,
but still under the some directory directories.
Secondly, because of the depth of your directory structure,
you should be using -mindepth 4... | Move files several directories up for several directories with similar layout |
1,663,035,968,000 |
How can I create a Nautilus script that moves a the selected file into a new folder with the same name?
My starting point:
/home/user/123
here 123 is a file with no extension
My goal here is to achieve this result:
/home/user/123/123
here we have the same file 123 inside new folder also named 123
I can't figure this o... |
You can't have two files by the same name at the same time, so you'll need to first create the directory under a temporary name, then move the file into it, then rename the directory. Or alternatively rename the file to a temporary name, create the directory, and finally move the file.
I see that Nautilus scripts can ... | Nautilus-script to move file into same name directory |
1,663,035,968,000 |
Due to an old backup concept I have some hard drives here, that contain file structures like:
/1.1
/2.1
/3.1
/FOLDER.DUPLICATE.$DRIVEBENDER/1.1
/FOLDER.DUPLICATE.$DRIVEBENDER/3.1
/FOLDER.DUPLICATE.$DRIVEBENDER/4.1
/Subfolder/1.2
/Subfolder/FOLDER.DUPLICATE.$DRIVEBENDER/2.2
/Subfolder/FOLDER.DUPLICATE.$DRIVEBENDER/3.2
... |
Assuming you don't have FOLDER.DUPLICATE.$DRIVEBENDER directories inside other FOLDER.DUPLICATE.$DRIVEBENDER directories, you could do something like:
find . -path '*/FOLDER.DUPLICATE.$DRIVEBENDER/*' -prune -type f -print0 |
perl -0lne '
if (m{(.*)/FOLDER.DUPLICATE.\$DRIVEBENDER/(.*)}s) {
$upperfile = "$1/... | If foldername equals "somestring", move all files in the folder one level up |
1,663,035,968,000 |
Here's a command to move all files whose name begin with 0 into a folder called zero :
mv [0]* zero
Question: What is a command for moving all files whose contents begin with 0 into a folder called zero?
Hopefully, there is a short command doing that also.
I know that the first character of the contents of a file is ... |
There isn't a command to do this. However, it's a straightforward piece of scripting.
Work out how to identify a file by its contents and move it:
f=example_file.txt
b=$(head -c1 <"$f")
[ "$b" = "0" ] && echo mv -- "$f" zero/
Work out how to iterate across all the 100,000 files in the directory:
find . -maxdepth 1 ... | How to move all files whose contents begin with 0? |
1,663,035,968,000 |
I have a filestructure with several subfolders where I'd like to search for all subfolder containing a certain string ("sub*") and then move all of the files in these found folders up one level from each of their respective location. And even potentially delete the then empty folder but I could do that with a second s... |
This should do it:
find /path/to/base/folder/ -type d -name 'sub*' -exec bash -c 'mv {}/* "$(dirname {})"' \;
NOTE: this will not move hidden files (whose name start with .)
| Move Files from Directory up one level |
1,663,035,968,000 |
I have downloaded files from another server to root directory called public_html, Now I am looking for move all files and folders from public_html to /home/userb/public_html
so I am trying to move it like below command
mv -v ~/public_html/* ~/home/userb/public_html/
but its giving me error called
mv: target '/root/h... |
Remove the tilde from /home/userb/public_html/. The tilde expands to the home directory of the user which in this case is root. As a result, you get:
/root/home/userb/public_html/
As per the error message, that directory doesn't exist.
What you want instead is this:
mv -v ~/public_html/* /home/userb/public_html/
As... | Move Files From Root Directory to another users Home Directory |
1,663,035,968,000 |
I have a directory structure like this;
dir
├── dirA
│ └── file1
│ └── subdir
└── dirB
└── file2
└── subdir
I need to move file1 to dirA/subdir and file2 to dirB/subdir. How can I do it in Linux?
|
Gnu find
find dir -mindepth 2 -maxdepth 2 -type f -execdir sh -c 'mv -t ./*/ "$1"' find-sh {} \;
find dir \
-mindepth 2 -maxdepth 2 -type f \
-execdir sh -c '
mv -t ./*/ "$1"
' find-sh {} \;
original directory structure
dir
├── dirA/
│ ├── fileA
│ └── subdir/
│ ├── e
│ ├── q
│ └─... | Move multiple files to subdirectories in linux |
1,663,035,968,000 |
Ohhhh, I've read a few pages and questions, but I just can't comprehend/fully understand it...
jdir0="$@" # /home/tor/subbackup/teest2/jjj
mv "$jdir0/subs/*.srt" /home/tor/subbackup/
mv: cannot stat '/home/tor/subbackup/teest2/jjj/*.srt': No such file or directory
Well, duh, yes, there is one test2.srt in there..
I... |
jdir0="$@"
"$@" expands to all positional parameters / arguments to the script. When you assign it to a single variable, Bash concatenates them joined with spaces. You probably want just $1 here.
mv "$jdir0/subs/*.srt"
The variable expansion should indeed be quoted, since it prevents word splitting, and globbing if ... | Move files with wildcard? |
1,663,035,968,000 |
I looked for similar questions, but it was hard to get a clear answer in my case.
I use my synology DS1515+ and DSM 6.2.2.
First of all, I have been made daily folder containing a date using script as below;
mkdir /volume1/video/$(date +%Y-%m-%d\(%a\))
This script is executed at daily midnight. So every midnight, thes... |
Try this,
for f in /volume1/video/*; do
# skip over directories
[ -f "$f" ] || continue
# grep the date in YYMMDD format
date=$(printf '%s' "$f" | grep -Eo '[0-9]{6}')
# set target path using date to convert YYMMDD to YYYY-MM-DD(%a)
target="/volume1/video/daily/$(date -d "$date" +%Y-%m-%d\(%a\))/"
# mv t... | Copy a file containing date in the file name to a folder for that date |
1,663,035,968,000 |
I wanted to recursively move files from a folder (Pictures) to another (Picturesnew).
The "Pictures" Folder had many subfolders and and hence I used this command after following up the posts here.
Both Pictures and Picturesnew were in the same directory. I just wanted to get rid of all the subfolders and combine the... |
I think you can achieve your goal with following command:
find Pictures -type f -print0 | xargs -0 mv -t Picturesnew
where Pictures is source directory and Picturesnew is destination directory.
Both mv (and cp) have format mv -t directory source... which fits good in use with xargs.
But this method will leave files... | Recursively moving contents of directory |
1,663,035,968,000 |
I am trying to copy/move a large file (15 GB) to a directory in Linux and want to have a dependency on that event.
Now lets say I have a file named abc.txt, and I am running below command:
mv /usr/tmp/abc.txt /usr/data/
When the move process start I see a file in data directory with the actual file name i.e. abc.txt... |
You must be moving between two different filesystems, so in effect the file is copied. Try to first copy it then, and after that's done, move within the destination. This should do:
mv /usr/tmp/abc.txt /usr/data/.abc.txt && mv /usr/data/.abc.txt /usr/data/abc.txt
I assume your watching process won't recognise the hid... | Copy or move large file with transient name till the file is completely transfered to destination in linux |
1,663,035,968,000 |
I have a list file with names of files, i want read one file name from the list at a time and look for it under a directory structure with multiple sub folders and then once found move it into a diff folder.
Ex:
listfile.txt
Content of the file--
filename1.txt
filename2.txt
maindir
|--subdir1
|---subdir2/filename1.... |
Using a shell loop and calling find once for each filename:
mkdir -p archive_dir
while IFS= read -r filename; do
find maindir -type f -name "$filename" -exec mv {} archive_dir ';'
done <listfile.txt
This would be slightly inefficient since it would continue looking for matching filenames even after finding the fi... | Find from a file list of and move in Unix |
1,677,595,947,000 |
I have thousands of text files called file.txt. Because they all share the same name I cannot move them to the same folder without them overwriting.
I need a command that will locate all of the file.txt files that are within thousands of directories and subdirectories, append the full path name to the end of the file ... |
Using find and a shell script to convert the paths to relative paths to the start directory and replacing / with _:
find . -type f -iname 'file*.txt' -exec sh -c '
targetdir=$1; shift
for file; do
cp "$file" "$targetdir/$(realpath --relative-base=. "$file" | tr '/' '_')"
# uncomment to restric... | Command to gather all specified text files, rename them, and copy them to a folder |
1,677,595,947,000 |
So I have files that need to remove/move/filter.
All files have this pattern like this in a directory, let's say directory frames contain this pattern filename timestamp_in_nanosecond.jpg.
And this is sample of that files with using pipelined tail from ls. ls | tail. (I'm using tail because ls too slow, maybe because ... |
Use a wildcard
mv 1660649147?????????.jpg frames2/
Depending on whether or not you mean to include the upper limit, maybe also
mv 1660649148000000000.jpg frames2/
If there are too many files for the wildcard to match without running out of buffer space, use find instead:
find . -name 'frames2' -prune -o -name '16606... | Remove/move files in a directory with filename timestamp pattern |
1,677,595,947,000 |
I have a daily rsync script backing up my data on an external hard drive at /mnt/X (root of hard drive). I am using --link-dest to use hard links and avoid duplicating data. I need to move all my daily backups from /mnt/X to /mnt/X/backups without loosing the hard links. Later I will need to change the script to backu... |
You don't have to do anything special. Simply,
mv /mnt/X/* to /mnt/X/backups/
(You will get an error about not being able to move backups to itself).
A hard link is basically an inode number. Files that are hard-linked have the same inode number. However you move them around within the same file-system, the inode nu... | Move daily backup directories (made by rsync) to another directory in the same partition |
1,677,595,947,000 |
I have thousands of files with various prefixes, and those prefixes are grouped in a csv list. Now I want to move all of them to their folder according to their list.
For instance: file A1B1C1_{...}.png, A1B2C2_{...}.png, A1B1C3_{...}.png, etc.
CSV List:
Name Group
A1B1C1 John
A2B1C1 John
A1B2C2 Denver
A1B1C3 Nick
... |
awk 'NR > 1 { print $1, $2 }' list.csv |
while read -r prefix group; do
find . -type f -name "$prefix*" -exec sh -c '
group="$1"; shift
mkdir -p "$group"
for name do echo mv "$name" "$group"; done' sh "$group" {} +
done
This would use awk to feed a while loop with the prefixes and group na... | Move all files with matching prefixes to folder based on a csv list |
1,677,595,947,000 |
I want to selectivly move all files that are movies with the year at the end of the filename. I have a program that renames movies and fixes the format which always uses Moviename (YEAR).extension format.
I tried mv *(*).* but it just moved everything. I figure the best way would be to do something like move files wit... |
*'('*')'.* should work.
Better yet, *'('????')'.* should get only the names
that have four characters between the parentheses.
Parentheses are special characters, so you have to put them in quotes.
| Move files containing Brackets and Year eg (1999) |
1,677,595,947,000 |
There are two OSes on my PC : Debian8.1 and Win7.
The Win7 was mounted on /media/root/1610D6B410D699D7 when Debian8.1 was loaded.
I then tried to move a Debian iso without success.
Why can't I move the iso file into /media/root/1610D6B410D699D7?
mv /home/debian8.1.iso /media/root/1610D6B410D699D7
mv: cannot create ... |
It may be an NTFS problem.
Look here.
Try:
sudo aptitude update && aptitude install ntfs-3g
umount /media/root/1610D6B410D699D7
mount -t ntfs-3g /dev/sda5 /media/root/1610D6B410D699D7
chmod +w /media/root/1610D6B410D699D7
chmod u+w /media/root/1610D6B410D699D7
then move it.
| Why can't I move a file into an NTFS directory mounted RW? |
1,677,595,947,000 |
I have this parent directory X and these two subdirectories A and B (see Photo 1): Folder A contains files for specific subjects that I want to move to further corresponding folders within Folder B. For example, in folder A, I have a lot of files for different subjects that end with different extensions (eeg.eeg, eeg.... |
First, install the perl rename utility. You seem to be using a Mac, so you'll probably need to use brew, it has perl rename packaged - see https://formulae.brew.sh/formula/rename.
Once that's installed, you should be able to run something like:
$ find A/ -regex '.*_eeg.\(eeg\|vhdr\|vmrk\|json\)' \
-exec rename -n... | How to move files based on name correspondence with a folder? |
1,677,595,947,000 |
So I have multiple subdirectories in which many of them have only 1 file and the name of the filename is the same as the subdirectory name.
DIR A
--DIR B
----B.zip
--DIR C
----C2.zip
----C3.zip
--DIR D
----D.zip
So the ideal result should be:
both B.zip and D.zip moved to DIR A
DIR B and DIR D is now empty and need ... |
We use GNU find utility, which traverses the directory tree and gathers information along the way. -depth option will make find do a depth-first traversal of the tree
and we come up directory names that store exactly one regular file. Then we move that file up abd tgen delete the just emptied directory.
find . -depth ... | How to search subdirectories that has only 1 file inside and move the file up one step to the parent directory |
1,677,595,947,000 |
I have a problem where I need to rename just certain files after the parent folder and afterwards move these to a central folder. Is there a way to do this?
I would like to run this on a Synology NAS.
Root
|-Subf1
| |-File.txt
| |-File.doc
| |-Subf1subf1
| | |-File.xml
| | |-File.xls
| |-Subf1subf2
| ... |
#! /bin/bash
shopt -s globstar #enabled for '**' to match all files &directories recursively
#shopt -s dotglob #uncomment to enable to match on hidden files/directories too
cd /path/to/directory/Root
for pathname in ./**/*; do
[[ -f "$pathname" ]] && echo mv -v -- "$pathname" "${pathname%%/*}/${pathname%%/*}.$... | Rename files in any deep subfolder like the parent folder and move after to a central folder |
1,677,595,947,000 |
I have a directory structure which contains many files. I want to find similar files recursively and sort them based on their names.
The easy part: find all files named f*.ext and move them to a certain directory, let's say dir1.
But now I want to go through the tree again and find all t*.ext which have a match in di... |
Try this:
# Create dir2:
mkdir dir2
# After moving f* to dir1, loop through these files (dir1/f*):
for f in dir1/f*; do
# get the basename, cut off the "f" and put a "t" instead:
t=source-tree/t$(basename "$f" | cut -c 2-)
# If that file exists, move it to dir2
[ -f "$t" ] && mv "$t" dir2
done
| Sort files based on similarity of file names |
1,677,595,947,000 |
The problem I am facing is that I have a directory that contains thousands of subdirectories, each of those subdirectories contain more subdirectories, and inside of all of those are images.
What I have are thousands of these:
/1056/7624/image.png
I basically want to eliminate the 7624 directory here so that I end up ... |
for dir in */*; do
if [[ -d "$dir" ]]; then
(
cd "$dir"
mv -n * ..
cd ..
rmdir "$( basename "$dir" )"
)
fi
done
Be aware that any duplicated file or subdirectory names will not be moved and so the deep directories in those cases will not be removed, due to still containing files.
| Move contents of all sub subdirectories up into just their subdirectories |
1,677,595,947,000 |
I need to move a file to an archive folder, and add a timestamp in front of the file name.
mv /dev/DataStage/myProject/source/TEST/MyFile_*.csv
/dev/DataStage/myProject/Archive/TEST/MyFile_*.csv
moved MyFile_20180817.csv as My~1.csv instead of MyFile_20180817.csv
When I move the file to the archive folder, I also ... |
shorter with rename (it will fail in case of different Filesystems):
rename '' "/dev/DataStage/myProject/Archive/TEST/`date +%Y%m%d_%H%M`." /dev/DataStage/myProject/source/TEST/MyFile_*.csv
with loop
for file in /dev/DataStage/myProject/source/TEST/MyFile_*.csv ;
do
filename=`basename $file`
mv $file /dev/Da... | Moving file with wildcard and add timestamp to the file name |
1,677,595,947,000 |
I want to search by file extension and by texts and then copy a binary file inside the same folder. For instance, I am in directory A and finally like to copy all *.gdx files (in B,C,D) to somewhere.
A
|-- B
| |-- file1.out (a text file)
| |-- file1.gdx (a bi... |
With find:
find . -type f -name '*.out' -exec grep -q 'PATTERN' {} ';' \
-exec sh -c 'cp "$1" "${1%.out}.gdx" /somewhere' sh {} ';'
Alternatively:
find . -type f -name '*.out' -exec grep -q 'PATTERN' {} ';' \
-exec sh -c 'for name do cp "$name" "${name%.out}.gdx" /somewhere; done' sh {} +
This would find all... | Find directories by file extension and copying/moving somewherelse [closed] |
1,677,595,947,000 |
I have a LARGE amount of files in the following structure
all files in /base/, then 4 folders with 2 "random" letters, and then a series of files related to each other.
Example:
/base/ab/12/13/37/file1.txt
/base/ab/12/13/37/file2.txt
/base/ab/12/13/37/file3.txt
/base/cd/b8/e2/a1/other1.txt
....
/base/cd/b8/e2/a1/othe... |
This is what we start with:
$ tree base/
base/
|-- ab
| `-- 12
| `-- 13
| `-- 37
| |-- file1.txt
| |-- file2.txt
| `-- file3.txt
|-- af
| `-- f3
| `-- 45
| `-- 9e
| |-- third1.txt
| `-- third2.txt
`-- cd
`-- b... | How to move many different sub folders one level down? |
1,677,595,947,000 |
I have a large compute job running on a remote machine that generates ~40 data files every ~20 minutes. I would like to pull the generated files from the remote machine to my local machine as soon as they are generated, and immediately delete them from the remote machine.
I've gotten part of the way there using rsync... |
Well, this is all kind of like when you go to your doctor and say "Doc! It hurts when I do this!" and he says "So don't do that! Problem solved!".
rsync is for synchronizing directories but, from your description, you don't want to do that. You want to "unsync" two directories: you want the files to be in one, but n... | rsync - update sync list while rsync is running |
1,677,595,947,000 |
Replace the "10 minutes" with whatever value. Basically I only want to move the file if it's not growing any more. How can I do this on the command-line or a bash script?
A solution that is easy to cron is preferred.
Details:
OS: CentOS
What I have tried so far: nothing because I don't know where to even start
What ... |
One line command here:
find /path/to/dir1 -type f ! -mmin -10 -exec mv {} /path/to/dir2 \;
Replace -10 with whatever you want, the rule is:
+n for greater than n,
-n for less than n,
n for exactly n.
| How can I move a file to another folder, but only if it hasn't been modified since 10 minutes? |
1,677,595,947,000 |
CentOS zsh terminal, the path just typed or copied is very deep, need to change a word in the middle.
Ctrl-f or Ctrl-b can move cursor by one character.
Is there a way to move cursor by word, like vim?
|
use CRTL+Arrow Left or CRTL+Arrow Right
| How can I move terminal cursor by word? |
1,677,595,947,000 |
I have a bunch of files in sub-directories that I want to move to a different directory.
The directories are organized in one parent directory like this:
Apr1995
Apr1996
Aug1995
etc... (month then year)
so /Files/Apr1995 for example.
the files are formatted like this 1995___.info or 1995___.dat
I want to go into eac... |
Your second command will work but you didn't specify the file name. If you want to move all of the files matching the pattern of 1995_.info and/or 1995_.dat
find ./ -type f -name 1995*.info -exec mv {} /1995/info \;
find ./ -type f -name 1995*.dat -exec mv {} /1995/dat \;
If you want to do all years in one command:
fo... | Need to loop through folder and move files to different directory? [closed] |
1,677,595,947,000 |
I have a directory that contains 10,665 jpeg files.
I want to move 500 files to a new directory, and 500 to the next directory, etc.
The largest files must be moved first:
500-1 contains the 500 largest files, 500-2 the next largest 500 files, etc.
The reason I want to do this is that I want to give the JPEGs to som... |
On a Linux-based system or other one using GNU find you can use a loop something like this
find -maxdepth 1 -type f -printf '%s\t%P\0' |
sort -z -rn |
(
# x is max files per directory; d is directory number; k is file counter
x=500 d=1 k=1
while IFS=$'\t' read -r -d '' size path
... | Move every 500 files in new directory [closed] |
1,677,595,947,000 |
I am trying to achieve this using bash
I have a directory of files, a sample to get the picture is below:
January 2010 MA - C3 Edexcel.pdf
January 2010 MS - C3 Edexcel.pdf
January 2010 QP - C3 Edexcel.pdf
January 2011 MA - C3 Edexcel.pdf
January 2011 MS - C3 Edexcel.pdf
January 2011 QP - C3 Edexcel.pdf
I... |
This snipet of an script will do what you ask for several years:
for i in $(seq 2010 2020); do
mkdir -p "$i" &&
mv *"$i"*.pdf "$i"
done
| Bash command to create a folder and move specific files into it |
1,677,595,947,000 |
I can copy file but can not move it on my Mac Terminal.
I want to execute following command:
mv /apps/gfss/ipt/files/R2R/Japan_WHT/21940000/DATA.xlsx /apps/gfss/ipt/files/R2R/Japan_WHT/21940000/inprogress/
And I get following error:
mv: rename /apps/gfss/ipt/files/R2R/Japan_WHT/21940000/DATA_21940000.xlsx to /apps/g... |
Resolved:
I had to delete the folder /apps/gfss/ipt/files/R2R/Japan_WHT/21940000 and recreate it.
Then I cd to /apps/gfss/ipt/files/R2R/Japan_WHT/ and gave permission to 21940000 directory using chmod -R 777 21940000/
I think there was some hidden directory inside 21940000 created by some other user and hence I was un... | I can copy file but can not move it from my Mac Terminal [closed] |
1,465,441,289,000 |
Since google chrome/chromium spawn multiple processes it's harder to see how much total memory these processes use in total.
Is there an easy way to see how much total memory a series of connected processes is using?
|
Given that google killed chrome://memory in March 2016, I am now using smem:
# detailed output, in kB apparently
smem -t -P chrom
# just the total PSS, with automatic unit:
smem -t -k -c pss -P chrom | tail -n 1
to be more accurate replace chrom by full path e.g. /opt/google/chrome or /usr/lib64/chromium-browser
thi... | Get chrome's total memory usage |
1,465,441,289,000 |
Tried to run program X using 8 threads and it was over in n minutes.
Tried to run same program using 50 threads and it was over in n*10 minutes.
Why does this happen and how can I get optimal number of threads I can use?
|
This is a complicated question you're asking. Without knowing more about the nature of your threads it's difficult to say. Some things to consider when diagnosing system performance:
Is the process/thread
CPU bound (needs lots of CPU resources)
Memory bound (needs lots of RAM resources)
I/O bound (Network and/or har... | Why using more threads makes it slower than using less threads |
1,465,441,289,000 |
If a Unix (Posix) process receives a signal, a signal handler will run.
What will happen to it in a multithreaded process? Which thread receives the signal?
In my opinion, the signal API should be extended to handle that (i.e. the thread of the signal handler should be able to be determined), but hunting for infos on ... |
The entry in POSIX on "Signal Generation and Delivery" in "Rationale: System Interfaces General Information" says
Signals generated for a process are delivered to only one thread. Thus, if more than one thread is eligible to receive a signal, one has to be chosen. The choice of threads is left entirely up to the impl... | What happens to a multithreaded Linux process if it gets a signal? |
1,465,441,289,000 |
As I understand, the default stack size for a pthread on Linux is 16K. I am getting strange results on my 64-bit Ubuntu install.
$ ulimit -s
8192
Also:
pthread_attr_init(&attr);
pthread_attr_getstacksize(&attr, &stacksize);
printf("Thread stack size = %d bytes \n", stacksize);
Prints
Thread stack size = 8388608 ... |
int pthread_attr_setstacksize(pthread_attr_t *attr, size_t stacksize);
The stacksize attribute shall define the minimum stack size (in
bytes) allocated for the created threads stack.
In your example, the stack size is set to 8388608 bytes which corresponds to 8MB, as returned by the command ulimit -s
So that matc... | Default stack size for pthreads |
1,465,441,289,000 |
You can see the output from lscpu command -
jack@042:~$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 56
On-line CPU(s) list: 0-55
Thread(s) per core: 2
Core(s) per socket: 14
Socket(s): 2
NUMA node(s): ... |
“CPU(s): 56” represents the number of logical cores, which equals “Thread(s) per core” × “Core(s) per socket” × “Socket(s)”. One socket is one physical CPU package (which occupies one socket on the motherboard); each socket hosts a number of physical cores, and each core can run one or more threads. In your case, you ... | Understanding output of lscpu |
1,465,441,289,000 |
I use
tar -cJvf resultfile.tar.xz files_to_compress
to create tar.xz and
tar -xzvf resultfile.tar.xz
to extract the archive in current directory. How to use multi threading in both cases? I don't want to install any utilities.
|
tar -c -I 'xz -9 -T0' -f archive.tar.xz [list of files and folders]
This compresses a list of files and directories into an .tar.xz archive. It does so by specifying the arguments to be passed to the xz subprocess, which compresses the tar archive.
This is done using the -I argument to tar, which tells tar what progr... | How to use multi-threading for creating and extracting tar.xz |
1,465,441,289,000 |
$ ps -e -T | grep myp | grep -v grep
797 797 ? 00:00:00 myp
797 798 ? 00:00:00 myp
797 799 ? 00:00:00 myp
797 800 ? 00:00:00 myp
This shows the process myp with PID = 797 and four threads with different SPIDs.
How can I kill a particular thread of the process without killin... |
Threads are an integral part of the process and cannot be killed outside it. There is the pthread_kill function but it only applies in the context of the thread itself. From the docs at the link:
Note that pthread_kill() only causes
the signal to be handled in the
context of the given thread; the
signal actio... | How can I kill a particular thread of a process? |
1,465,441,289,000 |
Is there a multi-threaded cp command on Linux?
I know how to do this on Windows, but I don't know how this is approached in a Linux environment.
|
As Celada mentioned, there would be no point to using multiple threads of execution since a copy operation doesn't really use the cpu. As ryekayo mentioned, you can run multiple instances of cp so that you end up with multiple concurrent IO streams, but even this is typically counter-productive. If you are copying f... | Multithreaded cp on linux? [duplicate] |
1,465,441,289,000 |
I have a command-line script that performs an API call and updates a database with the results.
I have a limit of 5 API calls per second with the API provider. The script takes more than 0.2 seconds to execute.
If I run the command sequentially, it will not run fast enough and I will only be making 1 or 2 API calls p... |
I've used Stéphane Chazelas' pv-based solution for some time, but found out that it exited randomly (and silently) after some time, anywhere from a few minutes to a few hours. -- Edit: The reason was that my PHP script occasionally died because of a max execution time exceeded, exiting with status 255.
So I decided to... | How to run a command at an average of 5 times per second? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.