Hi all,
I've knowledge about timestamp and i'm trying to use it in a particular scenario. I've multiple folders inside which are different files. Now I'm trying to copy one file (say xyz) which is present in all the folders but has variation in it's content and time of creation into a let's say foldernew.
I'm trying to do this by copying the file xyz from each folders with the new name xyz_(it's orginal timestamp) into folder new.
Can this be done with a single command or do what should I write in a script to execute this?
Note: I want to add the timestamp of xyz when it is created not of the time of copy.
Hi Everyone,
I need some help on my bash script, I'm trying to rename a certain line in a file which might be 1 or more.
IDXCOUNT=`grep -c 'index .* on ' $FILENAME`;
for n in $(eval echo {1..$IDXCOUNT});
do
timestamp=$(date +"%s");
echo "Renaming index idx_$timestamp..";
if [ $n -eq 1 ]; then
sed -i "0,/^index [^)]* on /s/index idx_$timestamp on /" $FILENAME;
My problem is, if the sed target is 2 or more it will generate an idx_$timestamp that will cause duplicate index value when the script finish. My goal is to have the script recognize that when there are multiple index in the file, it will try to rename it one by one.
I'm new to bash so I'm not sure if I explained my issue well but I will appreciate any help!!
Thanks!
I'm running Xubuntu and it was a challenge just getting Copy.com on there. (I installed the desktop app on both of my computers.) Now that I have it though, I don't really know how to use it.
I know this is kind of more a Copy.com question, but I don't know anything about Copy.com (besides having it--lol) and besides, I like you LQ guys.
So yeah, I installed the desktop app for Copy.com on both of my computers. I know that if I put something in the Copy folder that will be available to both computers.
But how Copy does the backing up I don't know.
When I change a file or folder do I have to plop that into the Copy folder every time or does Copy somehow update the file or folder in the Copy folder automatically? (It doesn't seem to.)
Okay, when I, say, take the Documents folder from one computer and plop it into the Copy folder that's that. Then I take the Documents folder from the other computer and plop that into the Copy folder, then all the files from both folders will be in the Copy folder (and the Copy cloud), right?
Now I just removed a couple of files from a folder and copied and pasted the folder into the Copy folder. But then when I looked at the Copy folder the files I'd deleted were still there. What's the process? How does it work?
I mean, how does this work as a way of backing things up AND organizing things? To me it seems like a decent way of throwing stuff into the Copy folder (and cloud), but how is that different than Google Drive? I mean, that's not really a backup, is it? It's like a flash drive in the cloud.
And when I combined the same folders (with the same titles anyway, but they each had different files within them) from the two computers I'd expected each folder on each computer to have all the same files that were cumulatively on both. Instead, they're the same. And the cumulative is only on the Copy folder.
I like the notion of just throwing the folders and files into the Copy folder. It's much quicker than Google Drive. But the backing up feature eludes me and the syncing feature makes me fearful that I'll lose data or that the files will become hopelessly less organized.
Thanks.
Hi, I am trying to install a smartcard reader driver onto my ubuntu machine. I am not able run the make file.
The output of makefile is as follows:
Code:
amit@ubuntu:~/Downloads/Linux Driver/rts_pstor$ sudo make
sed "s/RTSX_MK_TIME/`date +%y.%m.%d.%H.%M`/" timestamp.in > timestamp.h
cp -f ./define.release ./define.h
make -C /lib/modules/3.16.0-36-generic/build SUBDIRS=/home/amit/Downloads/Linux Driver/rts_pstor modules
make[1]: Entering directory `/usr/src/linux-headers-3.16.0-36-generic'
arch/x86/Makefile:136: CONFIG_X86_X32 enabled but no binutils support
Makefile:652: Cannot use CONFIG_CC_STACKPROTECTOR_REGULAR: -fstack-protector not supported by compiler
make[1]: *** No rule to make target `Driver/rts_pstor'. Stop.
make[1]: Leaving directory `/usr/src/linux-headers-3.16.0-36-generic'
make: *** [default] Error 2
amit@ubuntu:~/Downloads/Linux Driver/rts_pstor$
The make file for this driver is as follows:
Code:
TARGET_MODULE := rts_pstor
EXTRA_CFLAGS := -Idrivers/scsi
obj-m += $(TARGET_MODULE).o
$(TARGET_MODULE)-objs := rtsx.o rtsx_chip.o rtsx_transport.o rtsx_scsi.o rtsx_card.o \
general.o sd.o xd.o ms.o spi.o
default:
sed "s/RTSX_MK_TIME/`date +%y.%m.%d.%H.%M`/" timestamp.in > timestamp.h
cp -f ./define.release ./define.h
make -C /lib/modules/$(shell uname -r)/build SUBDIRS=$(shell pwd) modules
debug:
sed "s/RTSX_MK_TIME/`date +%y.%m.%d.%H.%M`/" timestamp.in > timestamp.h
cp -f ./define.debug ./define.h
make -C /lib/modules/$(shell uname -r)/build SUBDIRS=$(shell pwd) modules
install:
cp $(TARGET_MODULE).ko /lib/modules/$(shell uname -r)/kernel/drivers/scsi -f
clean:
rm -f *.o *.ko
rm -f $(TARGET_MODULE).mod.c
Please let me know any of your comments.
Thanks,
Amit
I'm trying to figure out if find could do this. I have a folder with 1000 files. I want to delete 150 files on that folder regardless of timestamp and filename. Is there a tool, command or option on find that could do this, please let me know.
Combining mtime or ctime to find is not advisable since it will not count the files or even if there are matches, I would still need to sum up the files until I reach 150 files.
Any suggestions?
Hello every one,
I need to copy many files in to many folders in once, for example I have files result_1 result_2 result_3 and want to copy them to directories 1 2 3 respectively, how can I do that, I have tried cp, echo and find syntax but did not work out.
Any idea?
Hi,
I have an tar.gz file which when right click extract here on my ubuntu computer is extracted without issue. I have all the folders and all the files (links and one executable) in them.
But when i transfert this tar.gz to another system and use the command :
Code:
tar zxvf nameofthefile.tar.gz
I see in the terminal things like that :
Code:
usr/bin/unzip/lzop
usr/bin/xargsbin/mountpoin
usr/bin/telnet
bin/pipe_prog
usr/bin/lzma
bin
usr/bin/sort
which mean that the files must be extracted but when using "ls" intot he folders they are empty. All the links are not here and only the executable is extracted.
When i copy back the archive from the new system to my ubuntu system and extract it all the files are here without issue. Why is it only creating the folders and not extracting the links ?
Hi guys,
.
For no apparent actions from me, hidden folders and files show
in my /user/home directory, they are as follows:-
folders:
.adobe .cache .config .cups .filezilla .gimp-2.8 .gnupg .gphoto .gstreamer-0.10 .icedtea .java .local .macromedia .mozilla .pki .thumbnails
Files:
.bash_history .bashrc .esd_auth .ICEauthority
In my / directory
File: ./readahead
Seeking help to verify the above folder and files are not from a harmful source or application?
If they do not post any thread to the system, how can I conceal
these folders and files, so that they don't show up any more in
my home and / directory ?
Many thanks.
I want to copy a folder and have the same permission as a existing folder , I tried cp -r -p may copy permission but it also copy everything includes sub-directory and files to new folder , would advise the way how to create a folder with copying all files to new created folder ? thanks
Hello
How can I prepare a script which will scan /home for folders with 777 permission and then it will set 755 permissions on those folders.
command find /home/ -type d -perm 777
will scan the /home for folders with 777 permission, but know I need to set 755 permission on this folders.
Please help in resolving this issue.
Thank you
Regards!
Jeff80
Does anyone know a way to copy two files to multiple computers? I'm thinking of scp as the flavor of linux we're using does not include rdist.
I've read that scp can't copy multiple files, however maybe some scripting genius has figured out a way. Running two scripts (one for each file), is perfectly ok!
If anyone care to post very clear examples (i'm definitely not a programmer...) of scripts, etc, that would be great.
Thanks in advance to all those who can help!