Search code examples
pythonhadoophdfssnakebite

How to Create HDFS file


I know it is possible to create directory HDFS with python using snakebite

But I am looking to create a file on HDFS directory


Solution

  • using subprocess

    from subprocess import Popen, PIPE 
    
    (ret, out, err)= run_cmd(['hdfs', 'dfs', '-touchz', '/directory/filename'])