GNU ld cannot statically link with libboost but dynamically can - c

I'm trying to compile an msp430 debug stack pon OpenSUSE.
All prerequisites are installed. When I run it with static link option the linker says:
_filesystem -lboost_date_time -lboost_system -lbsl430 -lusb-1.0 -lrt -Wl,-Bdynamic -lpthread
/usr/lib/gcc/i586-suse-linux/4.8/../../../../i586-suse-linux/bin/ld: cannot find -lboost_thread
/usr/lib/gcc/i586-suse-linux/4.8/../../../../i586-suse-linux/bin/ld: cannot find -lboost_filesystem
/usr/lib/gcc/i586-suse-linux/4.8/../../../../i586-suse-linux/bin/ld: cannot find -lboost_date_time
/usr/lib/gcc/i586-suse-linux/4.8/../../../../i586-suse-linux/bin/ld: cannot find -lboost_system
/usr/lib/gcc/i586-suse-linux/4.8/../../../../i586-suse-linux/bin/ld: cannot find -lusb-1.0
/usr/lib/gcc/i586-suse-linux/4.8/../../../../i586-suse-linux/bin/ld: cannot find -lrt
collect2: error: ld returned 1 exit status
But when run with no static linking it correctly finds boost libs and links everything up. MSPDebug requires libbost version 1.53 and it is the version I have.
What is the secret here? Libboost is installed in /usr/lib.
> ls -l /usr/lib/libboost* | grep 1.53
lrwxrwxrwx 1 root root 25 04-13 15:55 /usr/lib/libboost_atomic-mt.so -> libboost_atomic.so.1.53.0
lrwxrwxrwx 1 root root 25 04-13 15:55 /usr/lib/libboost_atomic.so -> libboost_atomic.so.1.53.0
-rwxr-xr-x 1 root root 5420 2013-09-28 /usr/lib/libboost_atomic.so.1.53.0
lrwxrwxrwx 1 root root 25 04-13 15:55 /usr/lib/libboost_chrono-mt.so -> libboost_chrono.so.1.53.0
lrwxrwxrwx 1 root root 25 04-13 15:55 /usr/lib/libboost_chrono.so -> libboost_chrono.so.1.53.0
-rwxr-xr-x 1 root root 30300 2013-09-28 /usr/lib/libboost_chrono.so.1.53.0
lrwxrwxrwx 1 root root 26 04-13 15:55 /usr/lib/libboost_context-mt.so -> libboost_context.so.1.53.0
lrwxrwxrwx 1 root root 26 04-13 15:55 /usr/lib/libboost_context.so -> libboost_context.so.1.53.0
-rwxr-xr-x 1 root root 5372 2013-09-28 /usr/lib/libboost_context.so.1.53.0
lrwxrwxrwx 1 root root 28 04-13 15:55 /usr/lib/libboost_date_time-mt.so -> libboost_date_time.so.1.53.0
lrwxrwxrwx 1 root root 28 04-13 15:55 /usr/lib/libboost_date_time.so -> libboost_date_time.so.1.53.0
-rwxr-xr-x 1 root root 59064 2013-09-28 /usr/lib/libboost_date_time.so.1.53.0
lrwxrwxrwx 1 root root 29 04-13 15:55 /usr/lib/libboost_filesystem-mt.so -> libboost_filesystem.so.1.53.0
lrwxrwxrwx 1 root root 29 04-13 15:55 /usr/lib/libboost_filesystem.so -> libboost_filesystem.so.1.53.0
-rwxr-xr-x 1 root root 92172 2013-09-28 /usr/lib/libboost_filesystem.so.1.53.0
lrwxrwxrwx 1 root root 24 04-13 15:55 /usr/lib/libboost_graph-mt.so -> libboost_graph.so.1.53.0
lrwxrwxrwx 1 root root 33 04-13 15:55 /usr/lib/libboost_graph_parallel-mt.so -> libboost_graph_parallel.so.1.53.0
lrwxrwxrwx 1 root root 33 04-13 15:55 /usr/lib/libboost_graph_parallel.so -> libboost_graph_parallel.so.1.53.0
-rwxr-xr-x 1 root root 265044 2013-09-28 /usr/lib/libboost_graph_parallel.so.1.53.0
lrwxrwxrwx 1 root root 24 04-13 15:55 /usr/lib/libboost_graph.so -> libboost_graph.so.1.53.0
-rwxr-xr-x 1 root root 322280 2013-09-28 /usr/lib/libboost_graph.so.1.53.0
lrwxrwxrwx 1 root root 28 04-13 15:55 /usr/lib/libboost_iostreams-mt.so -> libboost_iostreams.so.1.53.0
lrwxrwxrwx 1 root root 28 04-13 15:55 /usr/lib/libboost_iostreams.so -> libboost_iostreams.so.1.53.0
-rwxr-xr-x 1 root root 96200 2013-09-28 /usr/lib/libboost_iostreams.so.1.53.0
lrwxrwxrwx 1 root root 25 04-13 15:55 /usr/lib/libboost_locale-mt.so -> libboost_locale.so.1.53.0
lrwxrwxrwx 1 root root 25 04-13 15:55 /usr/lib/libboost_locale.so -> libboost_locale.so.1.53.0
-rwxr-xr-x 1 root root 860656 2013-09-28 /usr/lib/libboost_locale.so.1.53.0
lrwxrwxrwx 1 root root 28 04-13 15:55 /usr/lib/libboost_math_c99f-mt.so -> libboost_math_c99f.so.1.53.0
lrwxrwxrwx 1 root root 28 04-13 15:55 /usr/lib/libboost_math_c99f.so -> libboost_math_c99f.so.1.53.0
-rwxr-xr-x 1 root root 50920 2013-09-28 /usr/lib/libboost_math_c99f.so.1.53.0
lrwxrwxrwx 1 root root 28 04-13 15:55 /usr/lib/libboost_math_c99l-mt.so -> libboost_math_c99l.so.1.53.0
lrwxrwxrwx 1 root root 28 04-13 15:55 /usr/lib/libboost_math_c99l.so -> libboost_math_c99l.so.1.53.0
-rwxr-xr-x 1 root root 50920 2013-09-28 /usr/lib/libboost_math_c99l.so.1.53.0
lrwxrwxrwx 1 root root 27 04-13 15:55 /usr/lib/libboost_math_c99-mt.so -> libboost_math_c99.so.1.53.0
lrwxrwxrwx 1 root root 27 04-13 15:55 /usr/lib/libboost_math_c99.so -> libboost_math_c99.so.1.53.0
-rwxr-xr-x 1 root root 63400 2013-09-28 /usr/lib/libboost_math_c99.so.1.53.0
lrwxrwxrwx 1 root root 28 04-13 15:55 /usr/lib/libboost_math_tr1f-mt.so -> libboost_math_tr1f.so.1.53.0
lrwxrwxrwx 1 root root 28 04-13 15:55 /usr/lib/libboost_math_tr1f.so -> libboost_math_tr1f.so.1.53.0
-rwxr-xr-x 1 root root 260384 2013-09-28 /usr/lib/libboost_math_tr1f.so.1.53.0
lrwxrwxrwx 1 root root 28 04-13 15:55 /usr/lib/libboost_math_tr1l-mt.so -> libboost_math_tr1l.so.1.53.0
lrwxrwxrwx 1 root root 28 04-13 15:55 /usr/lib/libboost_math_tr1l.so -> libboost_math_tr1l.so.1.53.0
-rwxr-xr-x 1 root root 236248 2013-09-28 /usr/lib/libboost_math_tr1l.so.1.53.0
lrwxrwxrwx 1 root root 27 04-13 15:55 /usr/lib/libboost_math_tr1-mt.so -> libboost_math_tr1.so.1.53.0
lrwxrwxrwx 1 root root 27 04-13 15:55 /usr/lib/libboost_math_tr1.so -> libboost_math_tr1.so.1.53.0
-rwxr-xr-x 1 root root 239868 2013-09-28 /usr/lib/libboost_math_tr1.so.1.53.0
lrwxrwxrwx 1 root root 22 04-13 15:55 /usr/lib/libboost_mpi-mt.so -> libboost_mpi.so.1.53.0
lrwxrwxrwx 1 root root 29 04-13 15:55 /usr/lib/libboost_mpi_python-mt.so -> libboost_mpi_python.so.1.53.0
lrwxrwxrwx 1 root root 29 04-13 15:55 /usr/lib/libboost_mpi_python.so -> libboost_mpi_python.so.1.53.0
-rwxr-xr-x 1 root root 80064 2013-09-28 /usr/lib/libboost_mpi_python.so.1.53.0
lrwxrwxrwx 1 root root 22 04-13 15:55 /usr/lib/libboost_mpi.so -> libboost_mpi.so.1.53.0
-rwxr-xr-x 1 root root 170452 2013-09-28 /usr/lib/libboost_mpi.so.1.53.0
lrwxrwxrwx 1 root root 35 04-13 15:55 /usr/lib/libboost_prg_exec_monitor-mt.so -> libboost_prg_exec_monitor.so.1.53.0
lrwxrwxrwx 1 root root 35 04-13 15:55 /usr/lib/libboost_prg_exec_monitor.so -> libboost_prg_exec_monitor.so.1.53.0
-rwxr-xr-x 1 root root 59284 2013-09-28 /usr/lib/libboost_prg_exec_monitor.so.1.53.0
lrwxrwxrwx 1 root root 34 04-13 15:55 /usr/lib/libboost_program_options-mt.so -> libboost_program_options.so.1.53.0
lrwxrwxrwx 1 root root 34 04-13 15:55 /usr/lib/libboost_program_options.so -> libboost_program_options.so.1.53.0
-rwxr-xr-x 1 root root 428764 2013-09-28 /usr/lib/libboost_program_options.so.1.53.0
lrwxrwxrwx 1 root root 25 04-13 15:55 /usr/lib/libboost_python-mt.so -> libboost_python.so.1.53.0
lrwxrwxrwx 1 root root 25 04-13 15:55 /usr/lib/libboost_python.so -> libboost_python.so.1.53.0
-rwxr-xr-x 1 root root 299512 2013-09-28 /usr/lib/libboost_python.so.1.53.0
lrwxrwxrwx 1 root root 25 04-13 15:55 /usr/lib/libboost_random-mt.so -> libboost_random.so.1.53.0
lrwxrwxrwx 1 root root 25 04-13 15:55 /usr/lib/libboost_random.so -> libboost_random.so.1.53.0
-rwxr-xr-x 1 root root 9712 2013-09-28 /usr/lib/libboost_random.so.1.53.0
lrwxrwxrwx 1 root root 24 04-13 15:55 /usr/lib/libboost_regex-mt.so -> libboost_regex.so.1.53.0
lrwxrwxrwx 1 root root 24 04-13 15:55 /usr/lib/libboost_regex.so -> libboost_regex.so.1.53.0
-rwxr-xr-x 1 root root 988512 2013-09-28 /usr/lib/libboost_regex.so.1.53.0
lrwxrwxrwx 1 root root 32 04-13 15:55 /usr/lib/libboost_serialization-mt.so -> libboost_serialization.so.1.53.0
lrwxrwxrwx 1 root root 32 04-13 15:55 /usr/lib/libboost_serialization.so -> libboost_serialization.so.1.53.0
-rwxr-xr-x 1 root root 432572 2013-09-28 /usr/lib/libboost_serialization.so.1.53.0
lrwxrwxrwx 1 root root 26 04-13 15:55 /usr/lib/libboost_signals-mt.so -> libboost_signals.so.1.53.0
lrwxrwxrwx 1 root root 26 04-13 15:55 /usr/lib/libboost_signals.so -> libboost_signals.so.1.53.0
-rwxr-xr-x 1 root root 83744 2013-09-28 /usr/lib/libboost_signals.so.1.53.0
lrwxrwxrwx 1 root root 25 04-13 15:55 /usr/lib/libboost_system-mt.so -> libboost_system.so.1.53.0
lrwxrwxrwx 1 root root 25 04-13 15:55 /usr/lib/libboost_system.so -> libboost_system.so.1.53.0
-rwxr-xr-x 1 root root 13824 2013-09-28 /usr/lib/libboost_system.so.1.53.0
lrwxrwxrwx 1 root root 25 04-13 15:55 /usr/lib/libboost_thread-mt.so -> libboost_thread.so.1.53.0
lrwxrwxrwx 1 root root 25 04-13 15:55 /usr/lib/libboost_thread.so -> libboost_thread.so.1.53.0
-rwxr-xr-x 1 root root 83832 2013-09-28 /usr/lib/libboost_thread.so.1.53.0
lrwxrwxrwx 1 root root 24 04-13 15:55 /usr/lib/libboost_timer-mt.so -> libboost_timer.so.1.53.0
lrwxrwxrwx 1 root root 24 04-13 15:55 /usr/lib/libboost_timer.so -> libboost_timer.so.1.53.0
-rwxr-xr-x 1 root root 18008 2013-09-28 /usr/lib/libboost_timer.so.1.53.0
lrwxrwxrwx 1 root root 38 04-13 15:55 /usr/lib/libboost_unit_test_framework-mt.so -> libboost_unit_test_framework.so.1.53.0
lrwxrwxrwx 1 root root 38 04-13 15:55 /usr/lib/libboost_unit_test_framework.so -> libboost_unit_test_framework.so.1.53.0
-rwxr-xr-x 1 root root 629872 2013-09-28 /usr/lib/libboost_unit_test_framework.so.1.53.0
lrwxrwxrwx 1 root root 23 04-13 15:55 /usr/lib/libboost_wave-mt.so -> libboost_wave.so.1.53.0
lrwxrwxrwx 1 root root 23 04-13 15:55 /usr/lib/libboost_wave.so -> libboost_wave.so.1.53.0
-rwxr-xr-x 1 root root 1141884 2013-09-28 /usr/lib/libboost_wave.so.1.53.0
lrwxrwxrwx 1 root root 33 04-13 15:55 /usr/lib/libboost_wserialization-mt.so -> libboost_wserialization.so.1.53.0
lrwxrwxrwx 1 root root 33 04-13 15:55 /usr/lib/libboost_wserialization.so -> libboost_wserialization.so.1.53.0
-rwxr-xr-x 1 root root 309416 2013-09-28 /usr/lib/libboost_wserialization.so.1.53.0

Static libraries in Linux have the ".a" extension.
Your boost lib directory only contains ".so" which are shared objects (dynamically linked).

Related

Сreating Bash array

Create array: array=($(ls -l))
Show full an array: echo ${array[#]}
Result: total 0 -rw-r--r-- 1 root root 0 Jul 14 05:54 1 -rw-r--r-- 1 root root 0 Jul 14 05:54 2 -rw-r--r-- 1 root root 0 Jul 14 05:54 3 -rw-r--r-- 1 root root 0 Jul 14 05:54 4 -rw-r--r-- 1 root root 0 Jul 14 05:54 5
Show part of an array: echo ${array[#]:0:11}
Result: total 0 -rw-r--r-- 1 root root 0 Jul 14 05:54 1
Show other part of an array: echo ${array[#]:11:20}
Result: -rw-r--r-- 1 root root 0 Jul 14 05:54 2 -rw-r--r-- 1 root root 0 Jul 14 05:54 3 -rw-r--r-- 1
Why not only elements 11-20 are shown, but also the rest?

How do I figure out which i2c device is which programmatically?

I have 11 i2c device nodes on my system.
localhost user # ls /dev/i2c*
/dev/i2c-0 /dev/i2c-1 /dev/i2c-10 /dev/i2c-2 /dev/i2c-3 /dev/i2c-4 /dev/i2c-5 /dev/i2c-6 /dev/i2c-7 /dev/i2c-8 /dev/i2c-9
I can figure out which one is which by poking around in the /sys filesystem:
localhost devices # pwd
/sys/bus/i2c/devices
localhost devices # ls -al
total 0
drwxr-xr-x 2 root root 0 Jan 10 15:45 .
drwxr-xr-x 4 root root 0 Jan 10 15:45 ..
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-0 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-0
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-1 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-1
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-10 -> ../../../devices/pci0000:00/0000:00:19.2/i2c_designware.5/i2c-10
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-10508825:00 -> ../../../devices/pci0000:00/0000:00:19.2/i2c_designware.5/i2c-10/i2c-10508825:00
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-2 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-2
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-3 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-3
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-4 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-4
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-5 -> ../../../devices/pci0000:00/0000:00:02.0/i2c-5
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-6 -> ../../../devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-6
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-7 -> ../../../devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-7
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-8 -> ../../../devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-8
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-9 -> ../../../devices/pci0000:00/0000:00:15.3/i2c_designware.3/i2c-9
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-INT343B:00 -> ../../../devices/pci0000:00/0000:00:19.2/i2c_designware.5/i2c-10/i2c-INT343B:00
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-INT343B:01 -> ../../../devices/pci0000:00/0000:00:19.2/i2c_designware.5/i2c-10/i2c-INT343B:01
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-PRP0001:00 -> ../../../devices/pci0000:00/0000:00:15.2/i2c_designware.2/i2c-8/i2c-PRP0001:00
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-PRP0001:01 -> ../../../devices/pci0000:00/0000:00:15.3/i2c_designware.3/i2c-9/i2c-PRP0001:01
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-SYNA7817:00 -> ../../../devices/pci0000:00/0000:00:15.0/i2c_designware.0/i2c-6/i2c-SYNA7817:00
lrwxrwxrwx 1 root root 0 Jan 10 15:45 i2c-SYNA7817:01 -> ../../../devices/pci0000:00/0000:00:15.1/i2c_designware.1/i2c-7/i2c-SYNA7817:01
The ones that I want are i2c-PRP0001-*, which I can see are currently symlinked to i2c-8 and i2c-9.
i2c offers no guarantee that these node numbers are stable (even across reboots). I would like to give my program the ability to look at an i2c device and determine if it's one I care about or not.
I could hack up a shell script to do basically what I just did on the command line, but is there a programmatic (C) way to find the device information (i.e. where does the kernel get the information that it writes to the sys filesystem)?

/usr/bin/ld: cannot find -lruby

I hope build ruby c extension with cmake, but I get /usr/bin/ld: cannot find -llibruby in console, here is my code:
CMakeLists.txt
cmake_minimum_required(VERSION 3.3)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
file(GLOB cs *.c)
include_directories($ENV{HOME}/.rbenv/versions/2.2.3/include/ruby-2.2.0/x86_64-linux
$ENV{HOME}/.rbenv/versions/2.2.3/include/ruby-2.2.0)
foreach (c ${cs})
get_filename_component(exe ${c} NAME_WE)
add_executable(${exe} ${cs})
endforeach ()
add_library(mytest SHARED MyTest.c)
link_directories($ENV{HOME}/.rbenv/versions/2.2.3/lib)
find_library(ruby NAMES ruby)
target_link_libraries(mytest ruby)
and here is ruby lib:
roroco#roroco-Zhaoyang-K49 ~/Dropbox/rbs/ro_plans $ lsa ~/.rbenv/versions/2.2.3/lib
total 61424
drwxr-xr-x 4 roroco roroco 4096 Nov 21 23:49 .
drwxr-xr-x 6 roroco roroco 4096 Oct 13 22:10 ..
lrwxrwxrwx 1 roroco roroco 16 Nov 21 23:49 libruby.so -> libruby.so.2.2.0
lrwxrwxrwx 1 roroco roroco 16 Nov 21 23:49 libruby.so.2.2 -> libruby.so.2.2.0
-rwxr-xr-x 1 roroco roroco 13573794 Nov 21 23:49 libruby.so.2.2.0
-rw-r--r-- 1 roroco roroco 49306632 Nov 21 23:47 libruby-static.a
drwxr-xr-x 2 roroco roroco 4096 Nov 21 23:49 pkgconfig
drwxr-xr-x 6 roroco roroco 4096 Oct 13 22:10 ruby

Error compiling kernel module, fatal error: linux/modversions.h: File or directory not found

i'm trying to compile a simple test kernel module but gcc drop me this error:
fatal error: linux/modversions.h: file or directory not found
but in
/usr/src contains the symlink to the linux souce indeed
ls -l /usr/scr/
drwxr-xr-x 2 root root 4096 apr 26 13:31 fglrx-14.9+ga14.201
lrwxrwxrwx 1 root root 39 lug 11 13:36 linux -> /home/nhoya/Scaricati/linux-source-3.16
drwxr-xr-x 2 root root 4096 lug 10 17:49 linux-config-3.16
drwxr-xr-x 4 root root 4096 lug 10 15:57 linux-headers-3.2.0-4-amd64
drwxr-xr-x 4 root root 4096 apr 26 22:24 linux-headers-3.2.0-4-common
lrwxrwxrwx 1 root root 23 giu 24 2012 linux-kbuild-3.2 -> ../lib/linux-kbuild-3.2
-rw-r--r-- 1 root root 81869308 mag 24 20:24 linux-source-3.16.tar.xz
drwxr-xr-x 12 root root 4096 giu 7 23:31 virtualbox-4.3.18
and
locate modversions.h
/home/nhoya/Scaricati/linux-source-3.16/include/config/modversions.h
/usr/src/linux-headers-3.2.0-4-amd64/include/config/modversions.h
So, i really don't understand the problem... this is the module source
#define __KERNEL__
#define MODULE
#include <linux/modversions.h>
#include <linux/module.h>
#include <linux/tty.h>
int init_mod()
{
console_print("test\n");
return 0;
}
void cleanup_mod()
{
console_print("fine test\n");
}

centos delete files in n days ago

My server is Centos 7.
My files structure is:
-rw-r--r-- 1 root root 13968 مه 31 15:53 Data---2015-05-31---13:23:01.tar.gz
-rw-r--r-- 1 root root 16037 مه 31 16:30 Data---2015-05-31---14:00:01.tar.gz
-rw-r--r-- 1 root root 20379 مه 31 18:30 Data---2015-05-31---16:00:01.tar.gz
-rw-r--r-- 1 root root 20379 مه 31 22:30 Data---2015-05-31---20:00:01.tar.gz
-rw-r--r-- 1 root root 21892 ژوئن 1 10:30 Data---2015-06-01---08:00:01.tar.gz
-rw-r--r-- 1 root root 25734 ژوئن 1 12:30 Data---2015-06-01---10:00:01.tar.gz
-rw-r--r-- 1 root root 27880 ژوئن 1 14:30 Data---2015-06-01---14:30:01.tar.gz
-rw-r--r-- 1 root root 33161 ژوئن 1 16:30 Data---2015-06-01---16:30:01.tar.gz
-rw-r--r-- 1 root root 33179 ژوئن 1 18:30 Data---2015-06-01---18:30:01.tar.gz
-rw-r--r-- 1 root root 35082 ژوئن 1 22:30 Data---2015-06-01---22:30:01.tar.gz
-rw-r--r-- 1 root root 54499 ژوئن 2 10:30 Data---2015-06-02---10:30:01.tar.gz
-rw-r--r-- 1 root root 57289 ژوئن 2 12:30 Data---2015-06-02---12:30:01.tar.gz
-rw-r--r-- 1 root root 61077 ژوئن 2 14:30 Data---2015-06-02---14:30:01.tar.gz
-rw-r--r-- 1 root root 63617 ژوئن 2 16:30 Data---2015-06-02---16:30:01.tar.gz
-rw-r--r-- 1 root root 63619 ژوئن 2 18:30 Data---2015-06-02---18:30:01.tar.gz
-rw-r--r-- 1 root root 63722 ژوئن 2 22:30 Data---2015-06-02---22:30:01.tar.gz
-rw-r--r-- 1 root root 63722 ژوئن 3 10:30 Data---2015-06-03---10:30:01.tar.gz
-rw-r--r-- 1 root root 63722 ژوئن 3 12:30 Data---2015-06-03---12:30:01.tar.gz
-rw-r--r-- 1 root root 63723 ژوئن 3 14:30 Data---2015-06-03---14:30:01.tar.gz
-rw-r--r-- 1 root root 63723 ژوئن 3 16:30 Data---2015-06-03---16:30:01.tar.gz
-rw-r--r-- 1 root root 63722 ژوئن 3 18:30 Data---2015-06-03---18:30:01.tar.gz
-rw-r--r-- 1 root root 63723 ژوئن 3 22:30 Data---2015-06-03---22:30:01.tar.gz
How can I delete files n days ago?
I use this commands and am not getting the correct result:
find CodeBackup/* -type f -mtime +1 -exec rm '{}' '+';
Delete files greater 1 day old:
find CodeBackup -type f -mtime +1 -exec rm -f {} \;

Resources