Skip to content

‘Housekeeping’ script to create folder and move files

I have been trying to investigate how to automate a script (shell or other) that periodically (once an hour for example) moves files with a constant naming convention to a folder (which is automatically created if not already there). The files are like this: Camera1_01_20171213221830928.jpg Camera1_01_2017121…

How can I pass in this echo statement into my function in bash?

So in my while loop I am trying to figure out how to pass in the echo statement into my function bitToSixtyFour as a parameter. It is saying that bitToSixtyFour is not found. Answer As defined the function takes argument $1 from command line : to read from standard input read it would be more efficient to use…

How to install konsole on Cent OS 7?

I have Cent OS 7. Since konsole tool is in kde package, I’ve installed it: But still konsole isn’t installed. So, how can I install it? Answer You can just install the konsole package. yum provides konsole Will return: konsole-4.10.5-4.el7.x86_64 : KDE Terminal emulator So you just have to install…

Copying a NamedTemporaryFile in Linux results in empty file

I am writing some contents to a tempfile.NamedTemporaryFile in Python 3 under Ubuntu 16.04. Under certain circumstances, I want to copy that file to a different location after the writing is done. The problem is reproduced with the following code: mytest.txt is empty once the execution is over. If I use delet…

Bash: Cut current path until a certain folder

lets say I have three bash files in different directories: If I call $(pwd) I get the path of the current directory. Is there a way to somehow “crop” this path until a certain folder? In the following an example is shown if the certain folder would be called “c”: In the case of script1…

How to ssh.invoke_shell() work under Linux

The problem is that in theory the var channel_data must have and print This: Inted of that, it print this: The host “xxxx@yyyyy~$” it never appeared, so the part of the code when I asked for: It never happened. The only difference from this, to the paramiko librarie example I saw, was that the cod…

Compare multiple columns for each row

Using a csv file, i will like to compare multiple columns to check if all values are the same or not. First row are the headers First column is the label The constant values should be from column 2 to the end ( can be 100 columns ) for the example i put only 8 columns. The purpose is to