시작하기무료로 시작하기

Cleaning up a directory

Continuing your work as a data scientist in a large organization, you were told today that a colleague has left for their dream job (lucky them!). Unfortunately, when their logins were terminated, all their files were dumped into a single folder.

The good news is that most of their useful code has been backed up. However, all their python files using the Random Forest algorithm are buried in the file dump.

The task has fallen to you to sift through the hundreds of files to determine if they are both Python files and contain a Random Forest model. This sounds like a perfect opportunity to use your Bash skills, rather than checking every single file manually.

Write a script that loops through each file in the robs_files/ directory to see if it is a Python file (ends in .py) AND contains RandomForestClassifier. If so, move it into the to_keep/ directory.

이 연습은 강의의 일부입니다

Introduction to Bash Scripting

강의 보기

실습형 인터랙티브 연습문제

이론을 실습으로 바꾸는 인터랙티브 연습 중 하나를 만나보세요

연습 시작