I am using python v3.4 on my server and I frequently need to copy/move multiple files from my local directory to hdfs directory. All my files are in sub-directories, which in turn are in MyDir. Here is the command which I use-
$ hdfs dfs -copyFromLocal MyDir/* /path/to/hdfs/
This command runs fine on server, but when I use the same command inside python using subprocess
>>> subprocess.call(['hdfs', 'dfs', '-copyFromLocal', 'MyDir/*', '/path/to/hdfs/'])
It gives the following error-
copyFromLocal: `MyDir/*': No such file or directory
1
P.S.- I also tried ['hadoop', 'fs', '-put'....]
instead of ['hdfs', 'dfs', '-copyFromLocal'....]
, it is also not working.
Can anyone help me on this? Any help would be appreciated.
EDIT- I need to move files along with sub-directories.