Created
February 28, 2019 08:38
-
-
Save viniroger/560eb31c6ea339c4599b605e412dd79c to your computer and use it in GitHub Desktop.
Execute bash script using python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import check_output | |
# List files using pattern and get most recent | |
bashCommand = ("ls -1t %s/saida/arquivos_clientes/cn*.txt | head -1" %path) | |
# Define file name as last string, striping by '/' | |
filename = str(check_output(bashCommand, shell=True).strip(), 'utf-8') | |
remoteFileName = filename.split('/')[-1] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment