Created 03-03-2018 01:57 AM
Move files from edge node to hdfs using single command with different file name
Created 03-03-2018 02:20 AM
Is this something you are looking for ? if not please elaborate your question on what exactly you want to achieve.
[spark@node-1 ~]$ touch 1 [spark@node-1 ~]$ touch 2 [spark@node-1 ~]$ hadoop fs -put 1 2 /tmp/ [spark@node-1 ~]$ hadoop fs -ls /tmp/ Found 12 items -rw-r--r-- 3 spark hdfs 0 2018-03-03 02:17 /tmp/1 -rw-r--r-- 3 spark hdfs 0 2018-03-03 02:17 /tmp/2
Created 03-03-2018 02:53 AM
I have a file which contains filename.0020180302 and filename.0020180301 and filename.0020182901 in edge node i want to move file to hdfs with file name with particular date . How to do that in single command
Created 03-03-2018 03:24 AM
@Santhosh Reddy You can use the data command as below and select the files.
[spark@node-1 ~]$ touch filename.0020180303 [spark@node-1 ~]$ ll filename.00`date +%Y%m%d` -rw-r--r--. 1 spark hadoop 0 Mar 3 03:20 filename.0020180303 [spark@node-1 ~]$ hadoop fs -put filename.00`date +%Y%m%d` /tmp/ [spark@node-1 ~]$ hadoop fs -ls /tmp/filename* -rw-r--r-- 3 spark hdfs 0 2018-03-03 03:21 /tmp/filename.0020180303
Created 03-03-2018 02:07 PM
I can not use * because lets suppose i have 100 files out of which i want to move only files that came in last 3 days . All I am looking for do it in single command . Thanks I appreciate your help
Created 03-03-2018 09:31 PM
'*' has been used just to list the files in HDFS, you can use filename.00`date +%Y%m%d` to specify the date format and then move them accordingly.
Created 03-03-2018 11:08 PM
Thanks for quick reply .Previously This is what I am doing. Now my question is Can I move all these 4 files in a single command ? Is there any & Operator available
hdfs dfs -copyToLocal /20180217_AAA_02172018_C.dat /tmp/AAA_02172018_C.dat
hdfs dfs -copyToLocal /20180218_AAA_02182018_C.dat /tmp/AAA_02182018_C.dat
hdfs dfs -copyToLocal /20180219_AAA_02192018_C.dat /tmp/AAA_02182018_C.dat
hdfs dfs -copyToLocal /201802120_AAA_021202018_C.dat /tmp/AAA_02182018_C.dat